ok i'm tryin to learn c++ and i'm using microsoft visual c++ (xmas present from my uncle) ok here's my problem, i have this function
but everytime i call it it just flies right over the cin.getline unless i call it before the last like 5 lines of mainCode:void pause() { char mybuffer [100]; cout << "Press Any key to continue"; cin.getline (mybuffer,100); }
i have no idea what it is but it's driving me nuts!! any help would be appreciated!Code:int main() { char choicetmp[5]; int choice; // char tempvar [256]; cout << "1.) Add 2 Numbers" << endl; cout << "2.) Subtract 2 Numbers" << endl; cout << "3.) Divide 2 Numbers" << endl; cout << "4.) Multiply 2 Numbers" << endl; cout << endl; cout << "Enter the number you want: "; cin.getline(choicetmp,5); choice = atoi(choicetmp); switch(choice) { case 1: add(); } pause(); return 0; }




Reply With Quote