我该如何解决这个c程序 [英] how do I solve this c program

查看:104
本文介绍了我该如何解决这个c程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 main()
{
int a,b;
printf( 输入a和b的值);
scanf( %d%d,& a,& b);
printf( a =%d b =%d,a,b);
}



这需要三个int数,但a和b应该是两个数字?

解决方案

< blockquote>尝试取出虚假空格:

 main()
{
int a,b;
printf( 输入a和b的值);
scanf( %d%d,& a,& b);
printf( a =%d b =%d,a,b);

}


main( )
{
     int a, b ;
     printf ( "Enter values of a and b" ) ;
     scanf ( " %d %d ", &a, &b ) ;
     printf ( "a = %d b = %d", a, b ) ;
}


this taking three int number but it should two number for a and b?

解决方案

Try taking out the spurious spaces:

main( )
{
     int a, b ;
     printf ( "Enter values of a and b" ) ;
     scanf ( "%d %d", &a, &b ) ;
     printf ( "a = %d b = %d", a, b ) ;

}


这篇关于我该如何解决这个c程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆