I am trying to make a function that repeats till I say exit out. For some strange reason it's complaining about the answers.
Code:
Error:Code:int add() { char answer; int a,b; int total; do { std::cout<<"Enter two numbers: "; std::cin>>a,b; total = a+b; std::cout<< total <<"\n\n"; std::cout<<"Do you wish to continue: Y/N"; std::cin>>answer; } while (answer = y || answer = Y); std::cout<<"Returning to menu\n\n"; return 0; }
Code:In file included from index.cpp:2:0: functions.cpp: In function âint add()â: functions.cpp:9:11: error: âyâ was not declared in this scope functions.cpp:20:34: error: âYâ was not declared in this scope




Reply With Quote