Hi everyone,
I'm relatively new to c++ programming and I was trying to create a program to convert things, such as a number of degrees celcius to fahrenheit. But I have been running into problems. First of all, I was trying to use the goto statement like here:
1 2 3 4 5 6 7 8 9
int main ()
{
cout << "Welcome";
strart:
...
...
goto start;
return 0;
}
but it hasn't been working. So I tried replacing it with a while statement:
Sorry, didn't mean to write 'strart' in the post, but that is not my problem. I wrote it correctly in the file. And the ...s are just there to replace some code and make the focusing on the problem easier.
Your problem is because you have a return statement within the while statement, but not after it. The compiler doesn't like it because if theoretically the while loop finished without the final else{return 0;} block being executed, then int main() wouldn't return anything, which is illegal for anything except void functions.
EDIT: Also, you forgot the beginning brace for main(), but maybe that was just a typo.