Well here is practically the same thing but using one pass by reference, the other function just uses a pass by value.
Included some Switch/Case which was supplied by Mario in another thread, though i edited some of it, still couldn't get it to work correctly.Code:#include <iostream> #include <stdio.h> #include <string> using namespace std; using std::string; using std::cout; using std::endl; using std::cin; void GetUserInput(string &Input) { cout << "Please enter Amino Acid Sequence \"H,P\": " << endl; cin >> Input; cout << "Worked" << Input << endl; cin.get(); } void GetSetupString(string theInput) { int Output[50]; theInput; int index; for (index = 0; index < 50; ++index) { switch (theInput[index]) { case 'H': Output[index] = 1; break; case 'P': Output[index] = 0; break; default: break; } } cout << "New" << endl << Output << endl; cin.get(); } int main () { string Input; GetUserInput(Input); GetSetupString(Input); }
When it was setup as string Output = theInput, + switch (Output[index]) it just gave me gibberish. Maybe becauseof changing a char to an int i don't know.
So i changed it to what it is now which just gives me amemory address, 0x22ef00 etc.
any ideas what could cause it? if i'am allowed to ask that is?