Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  1
Language: C/C++
Code:
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
    int x, y, r, i, k;
    float a;
    i=0;
    srand(time(0));
    for (k=1; k<=10; k++)
    {x=1+rand()%10;
    y=1+rand()%10;
    r=x*y;
    cout<<x<<"*"<<y<<"=";
    cin>>a;
    if(a==r) i++;
    else cout<<"wrong! "<<x<<"*"<<y<<"="<<r<<endl;}
    cout<<"right answers: "<<i<<endl;
 if(i==10)
    cout<<"Great";
    else
     if(i==9 || i==8)
     cout<<"Good";
     else
      if(i==7 || i==6)
      cout<<"Passably";
      else
      cout<<"Unbearable";
}
          
          
Comments: