The following is code for a VERY SIMPLE help menu
Everything in there works, except for the very last (or second to last if you want to be picky about it) statement; getchar()Code://help.h //help menu #include <iostream> using namespace std; void help(void){ int hop; cout<<"Type 1 for simple calc help\nType 2 for root calc help\nType 3 for powers help\nType 4 for circumference\nType 5 for equation help\nType 6 for vector help:\n"; cin>>hop; if(hop==1){ cout<<"Enter a simple problem, such as 4+7.8\nYou can use decimals or integers\nYou can use +-/* as functions\n"; }else if(hop==2){ cout<<"Select an option of which root\nEnter a number\nYou will recieve an approximate root\n"; }else if(hop==3){ cout<<"Enter a number and a power in the format x^y\nYou must include the ^ [carrot]\nYou recieve x to y power\n"; }else if(hop==4){ cout<<"Enter a number (r)\nYou receive the circumference\n"; }else if(hop==5){ cout<<"Enter an equation of one of the following formats:\n\nax+b=c\nc=ax+b\nb+ax=c\nax=c\nx+b=c\nc=x+b\nc=x+b\nc=ax\nc=b+ax/b=c+ax\nax=c+b/ax=b+c\nc+b=ax/b+c=ax\n"; }else if(hop==6){ cout<<"The program can return the sum/difference of two vectors\nThe product/quotient of a vector and a scalar\nOr the dot product of two vectors\n\n"; cout<<"Firstly you will be prompted to enter your first vector.\nAfter this, you will be prompted for a symbol.\n\n"; cout<<"You enter a symbol of + - * / or .\n\n"; cout<<"Depending on your symbol, you will be prompted for a vector or scalar\n\n"; }else{ cout<<"Invalid option\n"; }//end else/if cout<<"Keep in mind, that due to the formatting of all numbers,\nall answers are APPROXIMATE\n"; getchar(); }//end void help
the program in question is being implemented on a MAC, so getchar() is the equivallent of the windows getch() or getche() and doesn't need to be included
for some reason, whenever I access the function in which getchar() is contained, it alwasy ignores the getchar() statement
This provides some considerable problems concerning the easy reading of the output
any ideas?



LinkBack URL
About LinkBacks


