|
-
September 16th, 2009, 12:54 PM
#1
compiling errors
PHP Code:
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <iomanip>
using namespace std;
int main() {
int grade;
int random1;
int random2;
int answer;
// Introduce Program
cout << "Math Tutor Menu " << endl;
cout << " " << endl;
cout << "1. First Grade " << endl;
cout << "2. Second Grade " << endl;
cout << "3. Third Grade " << endl;
cout << " " << endl;
// Get Grade
cout << " Enter your grade (1-3): ";
cin >> grade;
// Get Problem to solve
if (grade < 1 || grade > 3) {
cout << "Sorry you don't meet the requirments to use this program. " << endl;
} else if (grade == 1) {
random1 = rand() 9;
random2 = rand() 9;
cout << " " << random1 << endl;
cout << "+" << random2 << endl;
} else if (grade == 2) {
random1 = rand() 89 + 10;
random2 = rand() 89 + 10;
cout << " " << random1 << endl;
cout << "+" << random2 << endl;
} else {
random1 = rand() 899 + 100;
random2 = rand() 899 + 100;
cout << " " << random1 << endl;
cout << "+" << random2 << endl;
}//end if
return 0;
}//end main
PHP Code:
1>c:\documents and settings\my documents\visual studio 2008\projects\mathtutor\mathtutor\mathtutor.cpp(31) : error C2143: syntax error : missing ';' before 'constant'
1>c:\documents and settings\my documents\visual studio 2008\projects\mathtutor\mathtutor\mathtutor.cpp(32) : error C2143: syntax error : missing ';' before 'constant'
1>c:\documents and settings\my documents\visual studio 2008\projects\mathtutor\mathtutor\mathtutor.cpp(36) : error C2143: syntax error : missing ';' before 'constant'
1>c:\documents and settings\my documents\visual studio 2008\projects\mathtutor\mathtutor\mathtutor.cpp(37) : error C2143: syntax error : missing ';' before 'constant'
1>c:\documents and settings\my documents\visual studio 2008\projects\mathtutor\mathtutor\mathtutor.cpp(41) : error C2143: syntax error : missing ';' before 'constant'
1>c:\documents and settings\my documents\visual studio 2008\projects\mathtutor\mathtutor\mathtutor.cpp(42) : error C2143: syntax error : missing ';' before 'constant'
Now I am far from done with this program, but I cant continue until it lets me do this part of it. So if anybody can help. It would be much appreciated
-
September 16th, 2009, 01:11 PM
#2
Re: compiling errors
Code:
random1 = rand() 9;
Is this correct code, or parsed by PHP tag?
Please use code tags to put C/C++ code, like this:
[code]Code here[/code].
If this is original code, you need to change it :
Code:
random1 = rand() %9;
-
October 7th, 2009, 01:14 AM
#3
Re: compiling errors
random1 = rand() 9;
random2 = rand() 9;
random1 = rand() 89 + 10;
random2 = rand() 89 + 10;
all these areas have error. please insert some arthamatic operation after rand() function and constant number.
-
October 22nd, 2009, 01:09 PM
#4
Re: compiling errors
Start Here... To get some ideas how rand() actually works and how to use it...
http://www.eternallyconfuzzled.com/a..._art_rand.aspx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|