this is a 5minute program to make and its taking me 5hours |
dont worry, we all had that in the beginning :)
I think i remember doing this very same program (from the same tutorial), spending days on improving it :P
if you want a challenge, try adding stuff like exponents, roots etc. :)
and try to rewrite the program using a switch (see
http://cplusplus.com/doc/tutorial/control/ for more info on that)
As for the program...
Try using float or double instead of int. Currently if you were to input decimal numbers, the program fails..
Also, try to avoid using this kind of while loop, because this creates an infinite loop. Try doing something like
1 2 3 4 5 6 7
|
char ans;
while(ans!='n') //instead of the while go_on==5 and the do loop. Just place this where the do-loop currently is :)
//code...
cout<<"would you like to continue (y/n)?"; //at the end of the program
cin>>ans;
|
by adding this you can also remove the
system("pause")
part...
Also, I don't really see why you have included windows.h. You're not using any commands of this library, so why add it? :)
Try to avoid using stuff like
system("pause")
and
system("cls")
, for more on that read:
http://cplusplus.com/forum/articles/11153/
Hope it helped :)
Cheers!