Error in return variable.
Hey all. I am new to C and C++
I am doing a test program and it does not return the variable called input in the input2 function. any help would be great.
Code:
#include <iostream>
using namespace std;
int input2(int input);
int main (int argc, char * const argv[]) {
// insert code here...
//int input=0;
int input;
//input=0;
input2(input);
cout<<input;
switch(input)
{
case 1:
printf("New Game");
break;
case 2:
printf("Load Game");
break;
case 3:
printf("high scores");
break;
case 4:
printf("Quiting!");
break;
default:
printf("Invalid Choice!");
break;
}
getchar();
return 0;
}
int input2(int input){
//int input;
//int test;
std::cout << "Hello, World!\n";
printf("\n\n1. Play Game\n");
printf("2. Load\n");
printf("3. High Scores\n");
printf("4. Quit\n\n");
printf("Selection: ");
cin>>input;
cin.ignore();
cout<<"\n"<<input<<"\n";
//test==input;
return input;
}