CrazyEngineers
  • Graphic design code

    rajesh_s

    Member

    Updated: Oct 25, 2024
    Views: 1.3K
    Can anyone post a simply graphic design code in c or c++?
    (the output of the code should look like a design(example:name or ball shape)
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • PraveenKumar Purushothaman

    MemberMar 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.
    Are you sure? This action cannot be undone.
    Cancel
  • rajesh_s

    MemberMar 6, 2011

    can u please post 1 small graphi program
    Are you sure? This action cannot be undone.
    Cancel
  • PraveenKumar Purushothaman

    MemberMar 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();
    }
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register