English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I need to create a program with 2 arrays. One array for Male and One array for female. Both arrays ranging from age 0 to 100. To start both arrays from 0 to 40 need a value of 100 for each age. Then a value of 0 for the rest of the ages up to 100. Then to output the array in a list. The rest of the program with calculations I think I can do I've just been stuck on this array part.

2007-04-27 14:43:43 · 2 answers · asked by Kyle 2 in Computers & Internet Programming & Design

2 answers

int males[101], females[101];
for (int i=0; i<41; ++i) males[i] = females[i] = 40;
for (int i=41; i<102; ++i) males[i] = females[i] = 0;

2007-04-27 14:51:33 · answer #1 · answered by McFate 7 · 0 0

int m[100], f[100],i;
for (int i=0; i<41; ++i) m[i] = f[i] =rand()%101;
for (int i=41; i<101; ++i) m[i] = f[i] = 0;

2007-04-27 23:23:03 · answer #2 · answered by Shawn L 1 · 0 0

fedest.com, questions and answers