Whenever I run the program that I am creating, a Calculator for the game "RISK" it compiles fine but when i enter the values to test it, I get numbers that i though would be outside the random number generators parameters. These numbers are the same every time though. I also tried to create a block of code to sort the number from highest to lowest. Here's what i used to generate random numbers :
#include <iostream>
#include <ctime>
#include <cstdlib>
1 2 3 4 5 6 7
srand((unsigned)time(0));
int aone = rand() % 6 + 1;
int atwo = rand() % 6 + 1;
int athree = rand() % 6 + 1;
int afour = rand() % 6 + 1;
int afive = rand() % 6 + 1;
that is supposed to create 5 random numbers between 1 and 6
Well a vector is like a dynamic array you'll need the #include <vector> header
1 2 3 4 5 6
vector<int>randomnumber; // this creates an empty vector
for (int i=0;i<5;i++)
{
randomnumber.push_back(rand()%6+1); // this adds a new element to the end of the vector which is the random number between 1 to 6
cout << randomnumber[i]<<endl; // this is just for checking if it's actually right.
}