Skip to content

Instantly share code, notes, and snippets.

@prateek-parashar
Created March 7, 2018 14:58
Show Gist options
  • Save prateek-parashar/af002d17166a1ff02ce64d94f67d0c73 to your computer and use it in GitHub Desktop.
Save prateek-parashar/af002d17166a1ff02ce64d94f67d0c73 to your computer and use it in GitHub Desktop.
Testing the rest program
#include <stdio.h>
#include <cs50.h>
#include <string.h>
bool is_rest(string s);
int main(void)
{
// Expect notes from user until EOF
while (true)
{
// Expect note
string line = get_string("");
// Check for EOF
if (line == NULL)
{
printf("That was the end of program");
break;
}
// Check if line is rest
if (is_rest(line))
{
printf("The above line was a rest\n");
}
else
{
printf("The above line was not a rest\n");
}
}
}
bool is_rest(string s)
{
// TODO
bool ans;
int test = strcmp("" , s);
if (test == 0)
{
ans = true;
return ans;
}
else
{
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment