I'm not sure whats wrong...
Code:#include <iostream> #include "math.h" #include "time.h" char *shapes[2] = {"ball", "cube"}; // two arrays for color and shape char *colors[4] = {"red", "blue", "orange", "green"}; int selectObject(int, int); //function prototype int main(){ int color = 0; //numbers to be used for selection and display int shape = 0; int loopNumber; for (loopNumber = 0; loopNumber <= 100; loopNumber++){ selectObject(color, shape); std::cout<< colors[color]<< " "<< shapes[shape]; } std::cin.get(); } int selectObject(int color, int shape){ std::srand(time(NULL)); // I thought this was to make each random number different? color = std::rand() % 3; // gets random number to decide member of array to display shape = std::rand() % 1; return color; return shape; }



LinkBack URL
About LinkBacks


