c++编程出现了错误提示 error C2181: illegal else without matching if

error C2018: unknown character '0xa3'
F:\新建文件夹\11.cpp(6) : error C2018: unknown character '0xba'
F:\新建文件夹\11.cpp(14) : error C2181: illegal else without matching if
F:\新建文件夹\11.cpp(20) : error C2181: illegal else without matching if
执行 cl.exe 时出错.
编程如下
#include<stdio.h>
void main()
{
float y,z;
int x;
printf("请输入产品号与件数":);
scanf ("%d%f",&x,&y);
switch(x)
{
case 1:printf("z=2.5*y\n",&z);break;
case 2:
if(y>10)
printf("z=12.8*0.9*y",&z);break;
else
printf("z=12.8*y",&z);break;

case 3:
if(y>20)
printf("z=4.8*0.8*y",&z);break;
else printf("z=4.8*y",&z);break;
}
}

////输出带& 是输出地址                                                                                                                                           
#include<stdio.h>
void main()
{
  float y,z;
  int x;
  printf("请输入产品号与件数:");/////////                                                                                                                                         
  scanf ("%d%f",&x,&y);
  switch(x)
    {
    case 1:printf("z=2.5*y\n",&z);break;/////你是想输出地址吗?要是不是地址就不要带&
    case 2:
      if(y>10)
        printf("z=12.8*0.9*y",&z);///////break;        ///// printf("z=12.8*0.9*y",z);                                                                                                                            
      else
        printf("z=12.8*y",&z);break;/////?是输出地址吗?

    case 3:
      if(y>20)
        printf("z=4.8*0.8*y",&z);//////break;          ///////////                                                                                                                            
      else printf("z=4.8*y",&z);break;//////
    }
}

追问

大神 我已经私信你了

追答

回答了

温馨提示:答案为网友推荐,仅供参考
相似回答