早教吧作业答案频道 -->其他-->
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语言的计算(电阻)请问要如...的网友还看了以下:
对于化学反应a+b→c+d,有关说法正确的是()A.如c、d为盐和水,则反应物一定为酸和碱B.如c 2020-05-13 …
下列表示"去某地"的意义的四个词中,哪个不能带宾语?A.之B.如C.适D.往8下列表示“去某地”的 2020-05-15 …
已知抛物线y=x平方-2x与直线y=kx+b交于A,B两点,A(-1,3)B(4,8),若设点C为 2020-05-16 …
摩擦力 皮带主动轮 从动轮是皮带带动轮转,还是轮带动皮带转?哪个先转?怎样判断主动轮,从动轮,或皮 2020-05-16 …
“xx市xx区xx镇xx中学”如何译成英文?我在翻译“xx市xx区xx镇xx中学”,如“C市D区E 2020-06-15 …
选择正确解释:之通国之善奕者也()一人虽听之()思援亏缴而射之虽与之俱学a奕秋b专心人c的d鸿鹄 2020-06-23 …
已知多项式ax四次方+bx立方+cx平方+dx+e=3x立方+x-1,求代数式3a的d次方-2b的 2020-07-05 …
--Howdeepisthehole?--It's().A.fourmetredeepB.four 2020-07-08 …
(8分)图中,烟草花叶病毒(TMV)与车前草病毒(HRV)的结构如A、B,侵染作物叶片的症状如C、D 2020-12-08 …
下图中,烟草花叶病毒(TMV)与车前草病毒(HRV)的结构如A、B,侵染作物叶片的症状如C、D。回答 2021-01-18 …