DragonTooth™



Welcome To DragonTooth (GameDEV). Our Administrators: Emptrix, Amethyst, Shizuko~Conan, Yamino. To Contact Us, e-mail: Dragon_Tooth@live.com.
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in
Welcome to DragonToothDEV Forum. We are currently not taking anymore new users, however we will accept users that has Friend's Recommendation. Members who's friends are joining please pm one of the Administrators the username of your friend's newly created account to get it activated.

Share | 
 

 Zac look here

Go down 
AuthorMessage
Emptrix
Staff Administrator
avatar

Posts : 1218
Points : 1916
Reputation : 13
Join date : 2009-05-09
Age : 27
Location : The World That Never Was

PostSubject: Zac look here   Tue Jun 25, 2013 1:07 pm

Code:
#include <iostream>
#include <ctime>
using namespace std;

int main() {
   srand(time(0));

   int random1;
   int random2;
   int random3;
   int temp;

   random1 = rand() % 30 + 20; //0to 29
   random2 = rand() % 31 + 20;
   random3 = rand() % 31 + 20;

   cout << "Random Number 1: " << random1 << endl;
   cout << "Random Number 2: " << random2 << endl;
   cout << "Random Number 3: " << random3 << endl;

   if (random1 < random3)   {
      temp = random1;
      random1 = random3;
      random3 = temp;
   } else if (random2 > random1) {
      temp = random2;
      random2 = random1;
      random1 = temp;
   } else {
      cout << "No change!" << endl;
   }
   cout << "First number: " << random1 << endl;
   cout << "Second number: " << random2 << endl;
   cout << "Third number: " << random3 << endl;
}

_________________
Back to top Go down
View user profile http://emptrix.tk
 
Zac look here
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
DragonTooth™ :: Help & Support :: Help & Requests-
Jump to: