Replies
Welcome, guest
Join CrazyEngineers to reply, ask questions, and participate in conversations.
CrazyEngineers powered by Jatra Community Platform
-
@praveenkumar-66Ze92 • Mar 6, 2011
You can simulate it using different looping structures... 😀 Try using for loop and including graphics.h functions. Like drawing a line from one co-ordinate to another, again clearing it off, using the delay() method, etc. -
@rajesh-s-qqMLTP • Mar 6, 2011
can u please post 1 small graphi program -
@praveenkumar-66Ze92 • Mar 6, 2011
Check this out... Its a game!
#include <iostream> using namespace std; int main() { int forever; int HIGH = 15; int LOW = 1; int HIGH1 = 50; int LOW1 = 0; int damage; int attack; int HEALTH; int enemyhealth; int travle; int TRYAGAIN; cout<<"IMPUT YOUR HEALTH\n"; cin>>HEALTH; cout<<"IMPUT ENEMY HEALTH\n"; cin>>enemyhealth; cout<<"1"; cin>>forever; while(forever == 1) { TRYAGAIN = 0; damage = rand() % (HIGH - LOW); attack = rand() % (HIGH1 - LOW1); travle = attack-damage; if (travle > 0) { enemyhealth = enemyhealth-travle; } if (travle < 0){ HEALTH = HEALTH+travle; } if (HEALTH <0) { cout<<"YOU HAVE DIED AND GONE NITHER UP NOR DOWN!"; system("Pause"); forever = -1; cout<<"TRY AGAIN! 1=YES 0=NO"; cin>>TRYAGAIN; HEALTH = +10; } if (enemyhealth <0){ cout<<"YOU HAVE CRUSHED YOUR ENEMY"; system("Pause"); forever = -1; cout<<"TRY AGAIN! 1=YES 0=NO"; cin>>TRYAGAIN; enemyhealth = +10; } cout<<"DAMMAGE="<<travle<<"\n"; cout<<"YOUR HEALTH="<<HEALTH<<"\n"; cout<<"ENEMY HEALTH="<<enemyhealth<<"\n"; system("Pause\n"); if (TRYAGAIN == 1){ forever = +1; travle = 0; TRYAGAIN = 0; cout<<"IMPUT YOUR HEALTH\n"; cin>>HEALTH; cout<<"IMPUT ENEMY HEALTH\n"; cin>>enemyhealth; } } cin.get(); }