Facebook launches new Place Tips feature in your News Feed
…
12 Best Features of Apple ~ iPhone 6 & iPhone 6 Plus
…
Start8 For Window 8
…
Google agrees privacy policy changes with data watchdog
…
How to watch Super Bowl XLIX on iPhone, iPad and other devices
…
Apple announces Apple Watch shipping in April
…
How to Get Better iOS 8 Performance on iPhone 5
…
Apple’s record-smashing Q1 2015 earnings: 74.5M iPhones, 21.4M iPads, $74.6B revenue
…
Friday, January 16, 2015
Guesing Game with C++ ~ Source Code
#include<iostream.h>
#include<stdlib.h>
int main(){
int isecret,iguess,i=1;
srand(time(NULL));
isecret=(rand()%100)+1;
cout<<"Welcome,You have 5 times to choose. Let's try!!!"<<"\n\n";
do{
cout<<"Guess the number from 1 to 100:"; cin>>iguess;
if(isecret<iguess)
cout<<"The secret number is lower."<<"\n";
else if(isecret>iguess)
cout<<"The secret number is higer."<<"\n";
i=i+1;
}while(isecret!=iguess&&i<=5);
if(isecret==iguess )
cout<<"Congradulation! You win.";
else
cout<<"You lose.";
return 0;
}
Labels:
cppprogramming
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment