Computing.Net > Forums > Programming > C++ need code please!!

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

C++ need code please!!

Reply to Message Icon

Name: Tim
Date: October 23, 2002 at 15:32:44 Pacific
OS: Windows 98
CPU/Ram: 128
Comment:

I need some coding for a c++.
Its a Maths test program. It is meant to composes
a maths test consisting of 10 addition,
subtraction or multiplication problems.
(operands in the range 0-12).
The user must answer all 10 problems correctly.

Please send me some code



Sponsored Link
Ads by Google

Response Number 1
Name:
Date: October 23, 2002 at 16:15:04 Pacific
Reply:

Try dropping the class because you deserve the F you are going to get.


0

Response Number 2
Name: jose
Date: October 23, 2002 at 22:44:05 Pacific
Reply:

here is some code that I did in one programming class I had long ago try it must work,, I did not compile but it should work and good luck in your class


/////////////// Park University
#include
#include
#include
#include
#include

using namespace std;
main()
{

int coran = 0;
int count = 1;
int incoran =0;
char response;
string z;

{
void inst();
cout > z;
cout > response;
}



switch (response)
{

case 'a' :
void add();
{

int a,b,c,ans,count,incoran,coran;

srand (time (NULL));
coran = 0;
count = 1;
incoran =0;
while (count> ans;
c=b+a;

if (c==ans)
{
cout > ans;
c=b*
a;

if (c==ans)
{
cout > ans;
c=a-b;

if (c==ans)
{
cout > ans;
c=b/a;

if (c==ans)
{
cout << "GREAT" << endl;
cout << "Your answer is correct" << endl;
cout << "\n" << endl;
++ coran;
++ count;

}
else
{
cout << "UNFORTUNATELY" << endl;
cout << "Your answer is incorrect" << endl;
cout << "Here is the correct answer" << endl;
cout << c << endl;
cout << "\n" << endl;
++ incoran;
++ count;

}

}
}
break;
case 'e':
{
cout << "Good bye" << endl;
}
break;
default: cout << "ENTER A,B,C,D,E," << endl;
break;





}
void close();
{

cout << "CONGRATULATIONS" << endl;
cout << z << endl;
cout << "YOU GOT" << endl;
cout << coran << endl
;
cout << "ANSWERS CORRECT" << endl;
cout << "\n" << endl;
cout << "AND YOU GOT" << endl;
cout << incoran << endl;
cout << "ANSWERS INCORRECT" << endl;
cout << "\n" << endl;
return main();
}
}



0

Response Number 3
Name: Ronin
Date: October 24, 2002 at 13:25:53 Pacific
Reply:

LOL

Here is a bit of C code for you. If you can't convert it to C++ then...

[ means less than symbol
] means greater than symbol

#include [stdio.h]

#define MAXNUM 4

int main(void)
{
char *testQ[MAXNUM] = { "What is 2+2: ",
"What is 2*2: ",
"What is 2-2: ",
"What is 2/2: " };

int testA[MAXNUM] = { 4, 4, 0, 1 };
int studentA[MAXNUM];

int i, j;

for(i = 0; i [ MAXNUM; i++)
{
printf("%d) %s", (i+1), testQ[i]);
scanf("%d", &studentA[i]);
}

for(j = 0; j [ MAXNUM; j++)
{
if(studentA[j] != testA[j])
{
printf("\nYou answered question %d, incorrectly.", (j+1));
printf("\nYou answered %d, but the correct answer is %d\n", studentA[j], testA[j]);
}
else
{
printf("\nYou answered question %d, correctly.", (j+1));
printf("\nThe correct answer is %d\n", testA[j]);
}
}

printf("\n\nEnd of test.");

return 0;
}

HTH


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


program error programme error



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: C++ need code please!!

need code for socket prog in C++ www.computing.net/answers/programming/need-code-for-socket-prog-in-c/1224.html

C++ Source Code for MP3 Player www.computing.net/answers/programming/c-source-code-for-mp3-player/8452.html

How can I convert C++ source code into J www.computing.net/answers/programming/how-can-i-convert-c-source-code-into-j/1001.html