|
-
June 14th, 2014, 09:29 AM
#1
C++ Help Why wont it print anything (functions)
\\this program is used for the user enter a number and guess the correct number where the int jackpot is the function and analyzes it.It debugs and all but it wont work help please.Im new to programming.
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
using std::srand;
using std::time;
using std::rand;
int jackpot(int a){
srand((unsigned int)time(0));
int loop;
int rand1 =rand() % 100 +1;
for(loop=0;a==rand1;loop++){
cout<<"Enter a number:";
cin>>a;
if(a<rand1)
{cout<<"Its too low ";
}
else if(a>rand1){cout<<"Its to high";
}}
cout<<"You have tried"<<loop<<"\n";
cout<<"Congratulations";
}
int main ()
{
cout<<"Hello,Please enter your 3 bets\n";
int guess1;
cout<<"Please enter your 1st bet:\n";
cin>>guess1;
int jackpot(guess1);
return 0;
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|