vendredi 20 février 2015

Copying a integer value from one integer into another

A very quick question l have to ask why the following will not work. I am an early programmer hence the reason l am asking for help.


I am trying to copy the value of num1gen into the integer of ballno1 and outputting it.


Code:



#include <iostream>
#include <stdlib.h>


using namespace std;

int main()

{
int ballno1 = 0;

srand(time(NULL));
int num1gen=(rand()%49+1);


ballno1 = ballno1 + num1gen;
cout<<ballno1<<" ";

}




Aucun commentaire:

Enregistrer un commentaire