全部问题 > 当前问题

我在黑色的框里面输入什么格式才是对的

#include <stdio.h>


main()



{


int a,b,temp;


printf("请输入a和b的值:");


scanf("%d%d,&a,&b");//多打了个双引号


printf("a=%d,b=%d ",a,b);


temp=a;


a=b;


b=temp;


printf("a=%d,b=%d ",a,b);



}


一只猪的感慨 2016-1-28 21:55:44

共 4 个回答

嘿嘿大人 2016-1-28 21:59:58

我不是给你说了么,多打了个双引号

改为scanf("%d%d",&a,&b);//多打了个双引号

一只猪的感慨 2016-1-28 22:01:02

回复 嘿嘿大人:我的意思是出现黑色的那个屏之后我打什么进去  我单独打2 3也不行 打a=2 b=3也不行

最佳答案

嘿嘿大人 2016-1-28 22:07:31

回复 一只猪的感慨:= =不要两边一起问嘛= =

没有人 2016-1-28 22:12:57

#include<stdio.h>

main()

{

int a,b,temp;

printf("请输入两个数:");

scanf("%d,%d",&a,&b);

    printf("a=%d,b=%d\n",a,b);

temp = a;

a = b;

b =temp;

printf("a=%d,b=%d",a,b);

}

你试试这个


问题来自: 变量修饰符