早教吧作业答案频道 -->其他-->
c语言的计算(电阻)请问要如何用C计算电阻的三色环如~~宗黑红==1K#include#include#includeintmain(intargc,char*argv[]){chara=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8,i=9,j=0;intx,y,z,p;
题目详情
c 语言的计算(电阻)
请问要如何用C计算电阻的三色环
如~~宗 黑 红 ==1K
#include
#include
#include
int main(int argc, char *argv[])
{
char a=1, b=2, c=3, d=4, e=5, f=6, g=7, h=8, i=9, j=0;
int x, y, z, p;
//explanation
printf("\nThis program is to calculate the roots of a quadratic equation.\n");
printf("a=宗 b=红 c=澄 d=黄 e=绿 f=蓝 g=紫 h=灰 i=白 j=黑\n");
//prompt for input
printf("Please choose the first colours you want:\n");
scanf(" %c", &x);
printf("Please choose the second colours you want:\n");
scanf(" %c", &y);
printf("Please choose the third colours you want:\n");
scanf(" %c", &z);
//calculation
p=(x*10+y)*pow(double(10),double(z));// 出现错误
printf("The vlaue of reisitance is %d\n", p);
system("PAUSE");
return 0;
}
我的答案是要有 K M P
如~~宗 黑 红 ==1K (不是 1000)
红 澄 绿 ==2.3M
==3.6P
可否在帮我修正一下
谢谢
无法执行
出现错误
int i=-1; bool flag=false;
8 C:\Dev-Cpp\main.c `bool' undeclared (first use in this function)
可否麻烦再看一下
请问要如何用C计算电阻的三色环
如~~宗 黑 红 ==1K
#include
#include
#include
int main(int argc, char *argv[])
{
char a=1, b=2, c=3, d=4, e=5, f=6, g=7, h=8, i=9, j=0;
int x, y, z, p;
//explanation
printf("\nThis program is to calculate the roots of a quadratic equation.\n");
printf("a=宗 b=红 c=澄 d=黄 e=绿 f=蓝 g=紫 h=灰 i=白 j=黑\n");
//prompt for input
printf("Please choose the first colours you want:\n");
scanf(" %c", &x);
printf("Please choose the second colours you want:\n");
scanf(" %c", &y);
printf("Please choose the third colours you want:\n");
scanf(" %c", &z);
//calculation
p=(x*10+y)*pow(double(10),double(z));// 出现错误
printf("The vlaue of reisitance is %d\n", p);
system("PAUSE");
return 0;
}
我的答案是要有 K M P
如~~宗 黑 红 ==1K (不是 1000)
红 澄 绿 ==2.3M
==3.6P
可否在帮我修正一下
谢谢
无法执行
出现错误
int i=-1; bool flag=false;
8 C:\Dev-Cpp\main.c `bool' undeclared (first use in this function)
可否麻烦再看一下
▼优质解答
答案和解析
下面是正文:
#include
#include
#include
int main(int argc,char *argv[])
{
char danwei[3]={'K','M','G'};
int i=-1; bool flag=false;
int x,y,z,p;
double pp;
//explanation
printf("\nThis program is to calculate the roots of a quadratic equation.\n");
printf("1=宗 2=红 3=澄 4=黄 5=绿 6=蓝 7=紫 8=灰 9=白 0=黑\n");
//prompt for input
printf("Please choose the first colours you want:\n");
scanf(" %d",&x);
printf("Please choose the second colours you want:\n");
scanf(" %d",&y);
printf("Please choose the third colours you want:\n");
scanf(" %d",&z);
//calculation
if(x9) { printf("input x error!"); return -1; }
if(y9) { printf("input y error!"); return -1; }
if(z9) { printf("input z error!"); return -1; }
while(z>=3 && i=1000.0 && i
#include
#include
#include
int main(int argc,char *argv[])
{
char danwei[3]={'K','M','G'};
int i=-1; bool flag=false;
int x,y,z,p;
double pp;
//explanation
printf("\nThis program is to calculate the roots of a quadratic equation.\n");
printf("1=宗 2=红 3=澄 4=黄 5=绿 6=蓝 7=紫 8=灰 9=白 0=黑\n");
//prompt for input
printf("Please choose the first colours you want:\n");
scanf(" %d",&x);
printf("Please choose the second colours you want:\n");
scanf(" %d",&y);
printf("Please choose the third colours you want:\n");
scanf(" %d",&z);
//calculation
if(x9) { printf("input x error!"); return -1; }
if(y9) { printf("input y error!"); return -1; }
if(z9) { printf("input z error!"); return -1; }
while(z>=3 && i=1000.0 && i
看了 c语言的计算(电阻)请问要如...的网友还看了以下:
关于导数的问题1.f(x)=根号下(1+x2)那么f'(x)是否等于x/2*(1+x2)2.f(x 2020-05-14 …
请问五位数电表如何计算五位数电表要怎么看如何计算啊前四位是黑框第五位数是红框、我家电表如下:我起始 2020-05-22 …
如果f(t)=t/(1+t),g(t)=t/(1-t),证明:证明:f(t)-g(t)=-2g(t 2020-05-23 …
如图所示,用水平外力F将黑板擦压在竖直的黑板上保持静止,当逐渐增大外力F时,黑板对黑板擦的摩擦力将 2020-05-24 …
7.长度L,线密度ρ的均匀杆,其中垂线上距杆a单位处有一质量m的质点M,求杆对M的引力.不必计算( 2020-06-26 …
如何计算液压缸活塞摩擦力拜托了各位插齿机插刀液压缸,在工作时,液压杆收到切削力的径向反力作用,计算 2020-06-30 …
如何计算产能?请看我举的一个例子.假设一个产品,分A、B、C、D、E、F道工序,各所需时间为:工序 2020-07-09 …
太阳黑子计式怎么来的R=k(10g+f)R---黑子相对数;k---换算系数(通常取1);g--- 2020-08-01 …
1、当f(x)=(1+x)的1/x次方时,f(x)的导数怎么求?如何推算2、f(x)=f(lnx)/ 2020-12-28 …
对于f(x)中f表示对应关系,那么(x)的含义是什么还有下面这句话应如何理解:函数f(x)对于任何实 2021-01-15 …