Hi all,
I'm very new to C programming, and I'm having some difficulty with the program I want to build...
What it needs to be is a program which asks the user for the number of resistors to be tested, then ask for the resistor values, then putting these values into an array. So far I've done this;
Code:
#include <stdio.h>
#include <math.h>
int main (void)
{
int n;
int x;
/* Header of Program */
printf ("\t\t The Resistor Company\n\n\t\t Resistance Checker\n\t\t __________________\n");
/* Request Number of Resistors to test - Do While Loop*/
do {
printf ("\nHow many resistors would you like to enter?\n[Enter a value between 2 and 10]\n\n");
scanf ("%d", &n);
if (n < 2 || n > 10)
{ printf ("\nYou have entered a number out of range.\nPlease re-enter!\n"); }
} while (n < 2 || n > 10);
printf ("\nNumber of resistors to test: %d\n\n", n);
/* Request Resistor Values */
printf ("\nResistor Value 1: ");
scanf ("%d", x);
/* End of Program */
system ("PAUSE");
return (0);
}
It's just the beginning I know, not really sure where to go from here. The resistor values need to be asked for, such that if the user input 5 resistor values to test, resistor values 1-5 need to be asked for. Then, each value need to be put into an array for future calculations (such as smallest resistor, largest resistor, mean resistance etc.).
The resistor values also must be between 1x10^-3 ohms and 1x10^6 ohms, i.e. between 1mOhm and 1MOhm.
Hope somebody can help with this?
Thanks in advance!
P.S. This is a homework assignment, I'm not expecting anyone to do it for me but just explain how I could do it and give me a few pointers. This would be very much appreciated