For my homework we are supposed to write a checksum that continues to display checksums until a carriage return is detected (Enter key is pressed). My checksum works fine and continues to prompt me for a string to convert it to a checksum, but my program is supposed to end after I press the enter key. In my code, I set up a while loop that continues to calculate the checksums. In particular I put:
while(gets(s) != "\r\n")
Where s in a string that the user has to input. I've also tried this with scanf, and my loop looked like:
while(scanf("%s",s) != '\n')
That did not work as well. Could anyone please give me some insight onto how to get this to work? Thanks