I am busy writing my first program. When I tried to test it gave 2 errors which I cant figure out what is wrong. Please help I am using Dev C++.
PS. I am still busy with the tutorials so dont know much about C++
Code:
#include <iostream.h>
#include <string.h>
int question1( int age);
int question2 ( char user_input,int age);
int main()
{
char string[256]; //define variables
char user_input[10];
int age;
cout<<"This is a question and answer game!\n"; //Question 1:
cout<<"Question 1: How old are you? "; //How old are you
cin>>age; //input
question1(age); //goto function q1
cout<<"Question 2: Do you get pocket money?\n";
cin.getline(user_input, 10, '\n');
question2(user_input, age); //unknown error
system ("pause");
}
int question1 (int age)
{
if (age > 13) //if age more then 13
{
cout<<"You are older then me!\n"; //output you are older then me on the screen
}
else
{
cout<<"You are younger then me!\n"; //otherwise say you are younger then me
}
return 0; //return 0
int question2 ( char user_input, int age)
{
if (!strcmpi("no", user_input)) //unknown error
{
if (age < 15)
{
cout<<"LOL you dont get pocket money\n";
}
}
return 0;
}
}