All that is man
10-24-2009, 04:05 AM
Alright well I've been trying to learn c++ for the past couple days... And this is what I've come up with. Please bear with me, that this is coming from a noob :)
#include<iostream>
#include"FunRc.rc"
using namespace std;
int main( void ){
string name;
string age;
bool correct;
name = prompt( "What is your name?", false, 0);
age = prompt( "Great, and how old are you?", true, 1 );
correct = yesorno( "So your name is " + name + " and your " + age + " years old?" );
if( correct ){
cout << "Great! Standby..." << endl;
}
if( correct = false ){
cout << "Well please reenter the information...";
endls( 2 );
}
system( "PAUSE" );
}
And this is FunRc.rc:
using namespace std;
void endls( int amount ){
int tempInt;
tempInt = 0;
while( tempInt != amount ){
cout << "" << endl;
tempInt = tempInt + 1;
}
}
string prompt( string question, bool endlinebefore, int endlines ){
string result;
if( endlinebefore ){
endls( 1 );
}
cout << question << endl;
cin >> result;
endls( endlines );
return result;
}
bool yesorno( string question ){
char temp;
cout << question << " <y / n>" << endl;
cin >> temp;
if( temp = 'y' ){
cout << "true" << endl;
return true;
}
if( temp = 'n' ){
cout << "false" << endl;
return false;
}
}
But no matter what I get this:
http://img194.imageshack.us/img194/2183/cerror.th.jpg (http://img194.imageshack.us/i/cerror.jpg/)
Its probally something really nooby but give me a break :)
#include<iostream>
#include"FunRc.rc"
using namespace std;
int main( void ){
string name;
string age;
bool correct;
name = prompt( "What is your name?", false, 0);
age = prompt( "Great, and how old are you?", true, 1 );
correct = yesorno( "So your name is " + name + " and your " + age + " years old?" );
if( correct ){
cout << "Great! Standby..." << endl;
}
if( correct = false ){
cout << "Well please reenter the information...";
endls( 2 );
}
system( "PAUSE" );
}
And this is FunRc.rc:
using namespace std;
void endls( int amount ){
int tempInt;
tempInt = 0;
while( tempInt != amount ){
cout << "" << endl;
tempInt = tempInt + 1;
}
}
string prompt( string question, bool endlinebefore, int endlines ){
string result;
if( endlinebefore ){
endls( 1 );
}
cout << question << endl;
cin >> result;
endls( endlines );
return result;
}
bool yesorno( string question ){
char temp;
cout << question << " <y / n>" << endl;
cin >> temp;
if( temp = 'y' ){
cout << "true" << endl;
return true;
}
if( temp = 'n' ){
cout << "false" << endl;
return false;
}
}
But no matter what I get this:
http://img194.imageshack.us/img194/2183/cerror.th.jpg (http://img194.imageshack.us/i/cerror.jpg/)
Its probally something really nooby but give me a break :)