#include <stdio.h>
main()
{
int a,b,c;
scanf("%d","%d","%c",&a,&b,&c);
printf("The input is: %c",c);
}
整形转字符型,你不怕溢出?
改了一下,还是出错:
改成楼上的
要用多个双引号,把中间的逗号去掉
scanf("%d" "%d" "%c",&a,&b,&c);
麻烦各位,我是在调这个程序时出现的scanf函数出错;(下面的红色代码)
#include <stdio.h>
#define INFINITY 1000
#define MAX_VERTEX_NUM 20
#define ERROR 0
#define OK 1
typedef enum{DG,DN,UDG,UDN} GraphKind;
typedef int VRType;
typedef int InfoType;
typedef char VertexTpye;
typedef int Status;
typedef struct ArcCell
{
VRType adj;
InfoType *info;//该弧相关信息的指针
} ArcCell,AdjMatrix[MAX_VERTEX_NUM][MAX_VERTEX_NUM];
typedef struct
{
char vexs[MAX_VERTEX_NUM];
AdjMatrix arcs;
int vexnum,arcnum;
GraphKind kind;
}MGraph;
main()
{
MGraph G;
int i,j,k,w,IncInfo;
char v1,v2;
char d;
int LocateVertex(MGraph,VertexTpye);
printf("please Enter into the number of Vertex Arc and Arc_information:\n");
scanf("%d,%d,%d",&G.vexnum ,&G.arcnum,&IncInfo);
printf("The Number of Vertex is %d,The Number of Arc is %d\n",G.vexnum ,G.arcnum );
//ffl
有一10*10矩阵,除去第一个点(0,0)和最后一点(9,9),还有八个点为1,其他都为0,要求用二维数组表示。八个点是随机生成的,编写相关程序表示矩阵所有可能情况。
真心求教各位高手,哎!本人太菜了!呵呵!
......