Souce :
- Code: Select all
dan@dans-computer:~/prog/cpp$ more number1.cpp
/*
* Dunno yet :s
*/
#include <iostream.h>
int linux()
{
int ans;
cout << "You use Linux, thats good, do you want to proceed?\nUse 1 for yes or anything else for no\n ";
cin >> ans;
if(ans == 1)
{
game();
}
else
{
cout << "Bye then :D\n";
return 0;
}
}
int win()
{
cout << "NO!\n";
return 0;
}
int other()
{
char ans2;
cout << "This may or may not work try anyway though\nif it doesnt work email me (doogee@punkass.com)\n";
cout << "Continue? (1 fpr yes or anythin else for no)\n";
cin >> ans2;
if(ans2 == 1)
{
game();
}
else
{
cout "Bye then :D\n";
return 0;
}
}
int game()
{
cout << "this is where the game will be\n";
return 0;
}
int main()
{
int os;
cout << "Welcome to my game, i still havnt figured out what the game will be\n";
cout << "Im just laying the foundations for the game that will be :D\n\n";
cout << "Anyway, first things first, what OS are you in right now??\n";
cout << "1 > Winders\n2 > Linux\n 3 > Other\n\n";
cin >> os;
switch(os)
{
case 1:
win();
break;
case 2:
linux();
break;
case 3:
other();
}
return 0;
}
And the errors:
- Code: Select all
dan@dans-computer:~/prog/cpp$ g++ -o mygame number1.cpp
number1.cpp:7: parse error before `1'
number1.cpp:10: syntax error before `<'
number1.cpp:11: syntax error before `>'
number1.cpp: In function `int other()':
number1.cpp:35: implicit declaration of function `int game(...)'
number1.cpp:39: parse error before string constant
number1.cpp: In function `int main()':
number1.cpp:64: `1' cannot be used as a function
dan@dans-computer:~/prog/cpp$


