求大佬看一下我这个c语言错在哪里,怎么改
#include<stdio.h>intserise(inta,intb)//abmeansthepartshouldbeplus{returna+b;}floatpar...
#include<stdio.h>
int serise(int a, int b)//ab means the part should be plus
{
return a + b;
}
float parallel(int c, int d)//cd means that shuold use parallel
{
return 1 / c + 1 / d;
}
float parallel_three(int e, int f, int d)//three to calculate ues parallel
{
return 1 / e + 1 / f + 1 / d;
}
float ohm_law(float r_all){
return 12 / r_all;
}
void p(float i)
{
printf("%.1f", i);
}
int main(){
int r1, r2, r3, r4, r5, r6, r7;
r1 = 100, r2 = 200, r3 = 300, r4 = 400, r5 = 500, r6 = 600, r7 = 700;
int partr1r2 = serise(r1, r2);
float partr3r4 = parallel(r3, r4);
float partr6r7 = parallel(r6, r7);
float partr5r6r7 = serise(r5, partr6r7);
float r_all = parall_three(partr1r2, partr3r4, partr5r6r7);
float i = ohm_law(r_all);
} 展开
int serise(int a, int b)//ab means the part should be plus
{
return a + b;
}
float parallel(int c, int d)//cd means that shuold use parallel
{
return 1 / c + 1 / d;
}
float parallel_three(int e, int f, int d)//three to calculate ues parallel
{
return 1 / e + 1 / f + 1 / d;
}
float ohm_law(float r_all){
return 12 / r_all;
}
void p(float i)
{
printf("%.1f", i);
}
int main(){
int r1, r2, r3, r4, r5, r6, r7;
r1 = 100, r2 = 200, r3 = 300, r4 = 400, r5 = 500, r6 = 600, r7 = 700;
int partr1r2 = serise(r1, r2);
float partr3r4 = parallel(r3, r4);
float partr6r7 = parallel(r6, r7);
float partr5r6r7 = serise(r5, partr6r7);
float r_all = parall_three(partr1r2, partr3r4, partr5r6r7);
float i = ohm_law(r_all);
} 展开
1个回答
展开全部
float r_all = parall_three(partr1r2, partr3r4, partr5r6r7); 要改成 :
float r_all = parallel_three(partr1r2, partr3r4, partr5r6r7);
另外,有parallel和parallel_three函数要修改成:
float parallel(int c, int d)//cd means that shuold use parallel
{
return 1.0 / c + 1.0 / d;
}
float parallel_three(int e, int f, int d)//three to calculate ues parallel
{
return 1.0 / e + 1.0 / f + 1.0 / d;
}
float r_all = parallel_three(partr1r2, partr3r4, partr5r6r7);
另外,有parallel和parallel_three函数要修改成:
float parallel(int c, int d)//cd means that shuold use parallel
{
return 1.0 / c + 1.0 / d;
}
float parallel_three(int e, int f, int d)//three to calculate ues parallel
{
return 1.0 / e + 1.0 / f + 1.0 / d;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询