summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Van Doorn <vandoorn.nick@gmail.com>2007-03-19 14:34:37 -0700
committerNick Van Doorn <vandoorn.nick@gmail.com>2007-03-19 14:34:37 -0700
commit77b9886638a47257b1b7e2accd9241ac0b8d61bf (patch)
treec14232351ef480c6d8a45b5f911e90498e25e680
Init commit
-rwxr-xr-xtimetabletester5.cpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/timetabletester5.cpp b/timetabletester5.cpp
new file mode 100755
index 0000000..9436b49
--- /dev/null
+++ b/timetabletester5.cpp
@@ -0,0 +1,70 @@
+#include <iostream>
+#include <cstdlib>
+#include <stdlib.h>
+#include <time.h>
+#include <stdio.h>
+
+
+
+
+
+
+using namespace std;
+
+
+int main (int argc, char *argv[])
+{
+
+char exit=0;
+time_t curtime1,curtime2;
+int i=0,num1=0, num2=0, prod=0, num_question,num_c=0, num_w=0;
+
+printf("The Woofers Math Tester Version 5\n");
+printf("Copyright Woofers Studios 2007\n");
+printf("Made by Nicholas Van Doorn\n");
+printf("Enter answer and press enter\n\n");
+printf("How many questions would you like? ");
+cin >> num_question;
+printf("Making %d questions\n\n",num_question);
+srand((unsigned)time(NULL));
+curtime1 = time (NULL);
+
+while( (!exit) && (i<num_question) )
+{
+ num1=(int)rand()%12;
+ num2=(int)rand()%12;
+ printf("What is %d * %d = ",num1,num2);
+ cin >> prod;
+
+
+ while( (num1*num2 != prod) && prod!=-1)
+ {
+ printf("Wrong!");
+ num_w++;
+ cout<<"\n";
+ cout<<"\n";
+ printf("What is %d * %d = ",num1,num2);
+ cin >> prod;
+ }
+
+ printf("Correct!");
+ num_c++;
+ cout<<"\n";
+ cout<<"\n";
+ i++;
+ if(prod==-1)
+ exit=1;
+
+}
+curtime2 = time (NULL);
+printf("You got %d questions right first time\n",num_c);
+printf("You got %d questions wrong\n",num_w);
+printf("Your time was %ld seconds\n",curtime2-curtime1);
+printf("Your average time per question was %4.2f seconds\n\n",(float)(curtime2-curtime1)/(float)num_question);
+printf("Good Job!\n");
+printf("Press enter to exit");
+getchar();
+getchar();
+return(0);
+
+}