input output function
I need help with some code that I am working on.
#include <iostream>//header file for input output function
#include<cstdlib>
using namespace std;//it tells the compiler to link std namesapce
int main()
{//main function
int input,first_die,sec_die,total,count=0;//variable declaration and assignment
const int LOW = 1;
const int HIGH = 6;
cout<<“Enter the number between 2 to 12 :”;
cin>>input;//key board inputting
if(input<2 || input>12)
{
cout<<“Please enter the number between 2 to 12″<<endl;
exit(0);
}
do{//do while lop
first_die = rand() % (HIGH – LOW + 1) + LOW;//rand function to get random values
sec_die = rand() % (HIGH – LOW + 1) + LOW;
cout<<“First die value”<<first_die<<endl;
cout<<“second die value”<<sec_die<<endl;
total=first_die+sec_die;//total of 1st die and sec die
cout<<“total=”<<total<<endl;
count++;
}while(total!=input);
cout<<“no of tries=”<<count<<endl;
return 0;
}
I keep getting errors for undefined code.
"Looking for a Similar Assignment? Order now and Get 10% Discount! Use Code "Newclient"
