Ahh back again (audience *groan* ), i heard that
anway after looking over the tutorial on strings and trying to jury rig one into my old code to see if i could just get a simple comparison going.
Well i though i could make a seperate function (Finish) to check what output function (Alldone) gave and give a suitable response by comparing it to a predifined string.Code:# include <iostream> # include <stdio.h> # using namespace std; int Sequence() { int Sequence ; cout << "Input Residue Sequence: "<< endl; cin >> Sequence; cin.ignore(); cout << "Sequence entered: "<< Sequence <<"\n"; return 0; } char Alldone(void) { char done[100]; cout <<"All Done!"<< endl; cin >> done; cin.ignore(); cout << "Done: "<< done <<"\n"; cin.ignore(); return 0; /* if ( strcmp ( done, "Yes" ) == 0 ) //equal strings cout <<"Finished"<< endl; cin.ignore(); else cout<<"continue instead?"<<"\n"; cin.ignore(); return 0; */ } char Finish(void); { string done; getline(cin, done, '\n') if(done == "Yes") { cout<<"Finished"; cin.ignore() } else { cout<<"continue?"; cin.ignore(); } int main (int argc, char* argv[]) { Sequence(); Alldone(); Finish(); cin.get(); }
I'am thinking it probably isn't possible to compare "done" from the previous function (Alldone), but then i don't really know.
The stuff in blue was an earlier attempt until i found out there is a C++ specific string version
Any help is greatly appreciated
Regards Wolfe



LinkBack URL
About LinkBacks




