I'm guessing there is a way easier way to make this so if anybody knows how any help would be apreciated.
Also it wont run on my maths teachers laptop which is running vista
- Code: Select all
#include "stdafx.h"
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
int main ()
{
int a, b, c, d, e;
srand ( time(NULL) );
a = rand() % 12 + 1;
b = rand() % 12 + 1;
c = a*b;
e = 0;
cout << "ok well maths isn't fun but DO IT! \n copyright© Benjamin Mikhaiel(bigfish) \n";
system("pause");
cout << a << "x" << b << "=";
cin >> d;
if (c == d)
{
cout << "correct ";
e = e+1;
}
if ( c != d)
{
cout << "fail ";
}
system("pause");
{
a = rand() % 12 + 1;
b = rand() % 12 + 1;
cout << a << "x" << b << "=";
cin >> d;
c = a*b;
if (c == d)
{
cout << "correct ";
e = e+1;
}
if ( c != d)
{
cout << "fail ";
}
}
system("pause");
{
a = rand() % 12 + 1;
b = rand() % 12 + 1;
cout << a << "x" << b << "=";
cin >> d;
c = a*b;
if (c == d)
{
cout << "correct ";
e = e+1;
}
if ( c != d)
{
cout << "fail ";
}
}
system("pause");
{
a = rand() % 12 + 1;
b = rand() % 12 + 1;
cout << a << "x" << b << "=";
cin >> d;
c = a*b;
if (c == d)
{
cout << "correct ";
e = e+1;
}
if ( c != d)
{
cout << "fail ";
}
system("pause");
}
{
}
{
a = rand() % 12 + 1;
b = rand() % 12 + 1;
cout << a << "x" << b << "=";
cin >> d;
c = a*b;
if (c == d)
{
cout << "correct ";
e = e+1;
}
if ( c != d)
{
cout << "fail ";
}
{
system("pause");
}
}
a = rand() % 12 + 1;
b = rand() % 12 + 1;
cout << a << "x" << b << "=";
cin >> d;
c = a*b;
if (c == d)
{
cout << "correct ";
e = e+1;
}
if ( c != d)
{
cout << "fail ";
}
{
system("pause");
}
a = rand() % 12 + 1;
b = rand() % 12 + 1;
cout << a << "x" << b << "=";
cin >> d;
c = a*b;
if (c == d)
{
e = e+1;
cout <<"correct\n congrats or not u got " <<e<< " correct\n";
}
if ( c != d)
{
cout <<"fail\n Congrats or not u got " <<e<< " correct\n";
}
system("pause");
}


