selected a' random problem

please help i dont' know how to add input example= if i select 1 output wil be 43 but in the random chase sorry for my bad english i'm is beginner here

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
   #include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<time.h>
#include<iostream>

int main(){
   srand(time(NULL));
   int x;
   for(int i=0; i<6;i++){
        x =rand() % 100 + 1;
        std::cout<<"==============================="<<std::endl;
        printf("looping phase to-%d =%d \n",i+1, x);
        std::cout<<"==============================="<<std::endl;
         {
}
   }
   getchar();
   return 0;
   }
Last edited on
what do you mean?
did you actually call the getchar function to remain the window open?
or to get a user input?
i mean user input
getchar();
well calling this function like this wont make any sense, it will just save you from calling the bad system("pause");.

if the user inputs something, where will it go? who's going to hold that information?.

by the way what exactly are you trying to do in this program?



Last edited on
i want to make random number and try to call the number with input them
Topic archived. No new replies allowed.