Created
March 7, 2018 14:58
-
-
Save prateek-parashar/af002d17166a1ff02ce64d94f67d0c73 to your computer and use it in GitHub Desktop.
Testing the rest program
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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