#include<stdio.h>
#include<math.h>
#include<string.h>

// function prototype


int rv (int, int [], double []); 

//main function
int main()
{
	int n;
	int res[10];
	double vol[10];
	double I[10];
	double C;
	int i;


	for (i = 0; i < 10; i++)
	{
	printf("Enter R and V for resistor %d: ", i+1);
	ReadRes(i,res,vol);
	
	}

	return 0;

}	// end of main function

int rv (int i, int res, double vol) {

	int count = 0;
	int n;
	while (count <10) {
	n = scanf("%d %lf",&res, &vol);
	if (n == EOF)
	{
		printf("No valid resistor value entered\n");
		break;
	}
	else
	{
		return 1;
	}
	count ++;
	}
	
}

I'm trying to read in resistor values (array) and use these values to calculate current and power using the basic formulas of ohms law.

the function int rv is used to reading values and i'm also trying to calculate current and power in this function... please help me!!!

Recommended Answers

All 4 Replies

help you in what?

is there a specific error you want to tell?
are you asking us for suggestions or instructions?
Are you unsure of what to do next?
or maybe the code doesn't give the correct output?

please specify

help you in what?

Is there a specific error you want to tell?
Are you asking us for suggestions or instructions?
Are you unsure of what to do next?
Or maybe the code doesn't give the correct output?

Please specify

i don't know what to do next?!

you have no operation on calculating current and power... is that what you want to do next?

hey are u calling the rv()??
i am not sure u are calling it and how can u think u are not able to enter the values of resistor?

and even check the prototype of rv function's parameters
you used array in prototype and using a normal variable in function definition..
please check it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.