M
Meyer von Landenhausen
hi please take a look at the source:
#include <ctime>
#include <iostream>
using namespace std;
int main()
{
char buffer[3];
int i,r,temp;
int nums[50];
for(i = 1; i < 50; i++)
{
r = (rand() % 49) + 1;
temp = nums; nums = nums[r] = temp;
}
cout << "Your six lucky numbers are...\n";
cout << itoa(nums[1], buffer, 10) << " ";
cout << itoa(nums[2], buffer, 10) << " ";
cout << itoa(nums[3], buffer, 10) << " ";
cout << itoa(nums[4], buffer, 10) << " ";
cout << itoa(nums[5], buffer, 10) << " ";
cout << itoa(nums[6], buffer, 10) << " ";
cout << endl;
return 0;
}
whats wrong with it?
btw the prog shall creat 6 different 2-digit long numbers.
thx a lot guys
#include <ctime>
#include <iostream>
using namespace std;
int main()
{
char buffer[3];
int i,r,temp;
int nums[50];
for(i = 1; i < 50; i++)
{
r = (rand() % 49) + 1;
temp = nums; nums = nums[r] = temp;
}
cout << "Your six lucky numbers are...\n";
cout << itoa(nums[1], buffer, 10) << " ";
cout << itoa(nums[2], buffer, 10) << " ";
cout << itoa(nums[3], buffer, 10) << " ";
cout << itoa(nums[4], buffer, 10) << " ";
cout << itoa(nums[5], buffer, 10) << " ";
cout << itoa(nums[6], buffer, 10) << " ";
cout << endl;
return 0;
}
whats wrong with it?
btw the prog shall creat 6 different 2-digit long numbers.
thx a lot guys