Source File not comiled error message occures
include <iostream>
include <stdlib.h>
include <time.h>
using namespace std;
main(){#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
main(){
//declaraing and initialization integers
int secretNumber = 0, UserNum=0;
int UpperRange=0 , userMaxRand=0, LowerRange=0;
cout<<"My Student ID Mc140402241 "<<endl;
//Prompt the user to enter upper and lower Range for integers
cout<<"Please Enter Lower Range: ";
cin>>LowerRange;
cout<<"Please Enter Upper Range: ";
cin>>UpperRange;
// loop for exit program if invalid entery of number (if numbers are same or less from Lower Range) and if condition is true it will proceed next
if (UpperRange<=LowerRange)
{
cout<<"Your Upper Range Must Be Greater Then Lower Range"<<endl;
}
else if (LowerRange==UpperRange)
{
cout<<"Your Lower Range Must Be Smaller Then Upper Range"<<endl;
}
else
{
cout<<"Computer is calculating a random secret number...";
// Getting maximum number for randomizing from lower and upper Ranges
userMaxRand= UpperRange-LowerRange;
srand(time(NULL)); // This will ensure a really randomized number by help of time
// Randomizing the number
secretNumber = rand()% userMaxRand+LowerRange;
//On finishing randomiz number
cout<<"Done!"<<endl<<endl;
//Prompt the user to enter Guessing Number
cout<<"Please guesss the secret number in the range ["<<LowerRange<<" - "<<UpperRange<<" ]: ";
cin>>UserNum;
//Loop for compairing User guessing number with secretNumber of program
if(UserNum > secretNumber){
cout<<"Oooppssss...your entered number is too high...Computer won"<<endl;
}
else if(UserNum < secretNumber){
cout<<"Oooppssss...your entered number is too low...Computer won"<<endl;
}
else if(UserNum == secretNumber) {
cout<<"Wawoooo...Congratulations!...You won"<<endl;
}
else{
cout<<"Invalid Input"<<endl;
}
cout<<"\n\nSecret Number was: "<<secretNumber<<endl<<endl;
system("pause");
}
//declaraing and initialization integers
int secretNumber = 0, UserNum=0;
int UpperRange=0 , userMaxRand=0, LowerRange=0;
cout<<"My Student ID Mc140402241 "<<endl;
//Prompt the user to enter upper and lower Range for integers
cout<<"Please Enter Lower Range: ";
cin>>LowerRange;
cout<<"Please Enter Upper Range: ";
cin>>UpperRange;
// loop for exit program if invalid entery of number (if numbers are same or less from Lower Range) and if condition is true it will proceed next
if (UpperRange<=LowerRange)
{
cout<<"Your Upper Range Must Be Greater Then Lower Range"<<endl;
}
else if (LowerRange==UpperRange)
{
cout<<"Your Lower Range Must Be Smaller Then Upper Range"<<endl;
}
else
{
cout<<"Computer is calculating a random secret number...";
// Getting maximum number for randomizing from lower and upper Ranges
userMaxRand= UpperRange-LowerRange;
srand(time(NULL)); // This will ensure a really randomized number by help of time
// Randomizing the number
secretNumber = rand()% userMaxRand+LowerRange;
//On finishing randomiz number
cout<<"Done!"<<endl<<endl;
//Prompt the user to enter Guessing Number
cout<<"Please guesss the secret number in the range ["<<LowerRange<<" - "<<UpperRange<<" ]: ";
cin>>UserNum;
//Loop for compairing User guessing number with secretNumber of program
if(UserNum > secretNumber){
cout<<"Oooppssss...your entered number is too high...Computer won"<<endl;
}
else if(UserNum < secretNumber){
cout<<"Oooppssss...your entered number is too low...Computer won"<<endl;
}
else if(UserNum == secretNumber) {
cout<<"Wawoooo...Congratulations!...You won"<<endl;
}
else{
cout<<"Invalid Input"<<endl;
}
cout<<"\n\nSecret Number was: "<<secretNumber<<endl<<endl;
system("pause");
}