This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a console-based application for school teachers. | |
This application will auto generate questions for Grades 1, 2, 3, 4 and 5. | |
Using this application teacher will be able to give different paper to each student |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Program by Hammad Maqbool*/ | |
#include<iostream> | |
#include<conio.h> | |
#include<stdlib.h> | |
using namespace std; | |
void QuestionGenerator(int amountofq, int grade); | |
int RandomNumProvider(int digitRange); | |
int main() | |
{ | |
int UserChoice_=0; // To save userchoice | |
int NumberOfQ=0; // Loop helper | |
cout<<"1: First Grade.\n2: Second Grade.\n3: Third Grade.\n4: Fourth Grade.\n5: Fifth grade."<<endl; | |
cout<<"Please Select Grade, User number 1 to 5:"; | |
cin>>UserChoice_; | |
if(UserChoice_==1) | |
{ | |
cout<<"Enter number of questions you want to generate:"; | |
cin>>NumberOfQ; | |
QuestionGenerator(NumberOfQ,10); | |
} | |
else if(UserChoice_==2) | |
{ | |
cout<<"Enter number of questions you want to generate:"; | |
cin>>NumberOfQ; | |
QuestionGenerator(NumberOfQ,100); | |
} | |
else if(UserChoice_==3) | |
{ | |
cout<<"Enter number of questions you want to generate:"; | |
cin>>NumberOfQ; | |
QuestionGenerator(NumberOfQ,1000); | |
} | |
else if(UserChoice_==4) | |
{ | |
cout<<"Enter number of questions you want to generate:"; | |
cin>>NumberOfQ; | |
QuestionGenerator(NumberOfQ,10000); | |
} | |
else if (UserChoice_==5) | |
{ | |
cout<<"Enter number of questions you want to generate:"; | |
cin>>NumberOfQ; | |
QuestionGenerator(NumberOfQ,100000); | |
} | |
else | |
{ | |
cout<<"Invalid Choice!"; | |
} | |
return 0; | |
} | |
void QuestionGenerator(int amountofq, int grade_) | |
{ | |
int NewLiner = 0; | |
int RandomNum1=0; | |
int RandomNum2=0; | |
for(int i=1;i<=amountofq;i++) | |
{ | |
RandomNum1 = RandomNumProvider(grade_); | |
RandomNum2 = RandomNumProvider(grade_); | |
if(RandomNum1>RandomNum2) | |
{ | |
cout<<i<<". "<<"("<<RandomNum1<<"-"<<RandomNum2<<") = _________"; | |
} | |
else | |
{ | |
cout<<i<<". "<<"("<<RandomNum1<<"+"<<RandomNum2<<") = _________"; | |
} | |
cout<<"\t"; | |
NewLiner++; | |
if(NewLiner==3) | |
{ | |
cout<<endl; | |
NewLiner=0; | |
} | |
} | |
} | |
int RandomNumProvider(int DigitRange) | |
{ | |
int localDigit = DigitRange; | |
int Generated = localDigit +rand() % localDigit; | |
return Generated; | |
} | |
//This Program is coded by HammadMaqbool for learning Purpose... |
No comments:
Post a Comment