jeudi 17 mars 2016

Using Nested loop, rand(), and arrays

I am trying to get random numbers between 60-100 and create a loop that populates my temp[25][25] array in main() and calls my random function. I'm basically trying to make a program that takes a random temperature every hour and trying to get that to look like a chart with two columns. I apologize for any errors on my part as I'm quite new to this. Thank you, I appreciate it.

#include <stdio.h>
#include <stdlib.h>

int get_value(int);

int main() {
int te, ti, temp[25][25];

for(ti=0; ti<25; ti++)
    for(te=0;60<te<100;te++)
        te = get_value(te);
}

int get_value(int r)   {
    return r = (rand () % (100-60)) + 60;
}




Aucun commentaire:

Enregistrer un commentaire