Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <conio.h>
- #include <stdlib.h>
- #include <time.h>
- using namespace std;
- void draw_the_thing();
- char *thing[2] = {"cube", "shar"};
- char *color[4] = {"green","orange","red","blue"};
- int rand_num(int n);
- int main() {
- int n,i;
- srand(time(NULL));
- while (1) {
- cout << "enter number:" << " ";
- cin >> n;
- for (i=1; i <= n; i++)
- draw_the_thing();
- }
- getch();
- return 0;
- }
- void draw_the_thing() {
- int r;
- int s;
- r = rand_num(2);
- s = rand_num(4);
- cout << thing[r] << " " << color[s] << endl;
- }
- int rand_num(int n) {
- return rand() % n;
- }
Add Comment
Please, Sign In to add comment