The Rantings of a Teenager in the Prime Crap-itude of High School

Saturday, November 05, 2005

C++ MK 2.

Okay, this does exactly the SAME thing, but its shorter. Thx Eric. Still no clue? Compile it!

#include <'ctime>
#include <'cstdlib>
#include <'iostream>
using namespace std;

int main()
{
int array[] = {1,2,3,4,5,6,7,8,9,10,11,12};
int temp, x=0, numone, numtwo;
srand(time(0));
while (x<=500) {
numone=rand()%12;
numtwo=rand()%12;
temp=array[numone];
array[numone]=array[numtwo];
array[numtwo]=temp;
x++;
}
x=0;
while (x<=11)
cout <<
array[x++] << " ";
cout <<>
return 0;
}

Have Fun!

#include <'cstdlib>

using namespace.std;

int main()
{
cout<<"Motor.On"; //btw, you may not want to include the ' in the include lines...
system("pause");
return 0;
}

0 Comments:

Post a Comment

<< Home