jeudi 7 mai 2015

Random algorithm printing just the digit 3 [duplicate]

This question already has an answer here:

So far, this is my code:

#include <iostream>
#include <cstdlib>
using namespace std;
int number;
int main(){
   number = rand() % 13 + 1;
   cout << number;
   return 0;
}

I want to make the program to print a number between 1 and 13, but is printing just the digit 3.




Aucun commentaire:

Enregistrer un commentaire