I have a script here that I made and im having trouble with the do-while loop. I can either get it to run infinitely (continue) or only once (break). Maybe there's something wrong with the conditions I've set... I'm at a loss here, so any help would be greatly appreciated
#include <stdio.h>
#include <time.h>
int main ()
{
int age;
char string[50];
char string2[4];
int yearsleft;
/*
FILE *fp;
fp = fopen( "RetireeFileForCo.txt", "a+" );
*/
do {
printf( "What is your name? \n");
scanf( "%s", string );
printf( "Hello %s\n", string );
printf ("What is your age? \n");
scanf ("%d", &age);
printf ("You enter %d\n", age );
if ( age > 65 ) {
printf (".... You should already be retired %s\n", string );
// fputs ( ".... You should already be retired %s\n", fp, string );
} else {
yearsleft = 65 - age ;
printf ("Your number of years left until retirement is %d\n", yearsleft);
}
/*
fputs ( "As of the date above.... You should already be retired %s\n", fp );}}
fclose (fp);
*/
printf( "Do you want to check another person's status? (yes or no) \n");
scanf( "%s", string2 );
if("string2 = yes") {
continue;
}
printf ("Thank you for your input\n");
}
while("string2 = yes");
return 0;
}