visual studio2017中,定义控制台应用程序的入口点是什么意思,删除后对程序的运行有什么影响

// 111.c.cpp: 定义控制台应用程序的入口点。
//

#include "stdafx.h"

int main()
{
return 0;
}

scanf("%s %s %d %d %d",p[i].name,p[i].id,&p[i].x,&p[i].y,&p[i].z);
输入改为上句(你没对int类型变量取地址)
改过之后就不会 出内存错误了 (不崩溃了)
但是程序会陷入死循环
简单分析一下: 你的 point e 没有初始化就作为函数QueueTraverse的参数使用了
是不是这里的问题 我不太了解你写的程序的目的 所以不太清楚具体细节
一下是完整程序:

// testing2.cpp : 定义控制台应用程序的入口点。
//

#include<string.h> // 字符串函数头文件
#include<ctype.h> // 字符函数头文件
#include<malloc.h> // malloc()等
#include<limits.h> // INT_MAX等
#include<stdio.h> // 标准输入输出头文件
#include<stdlib.h> // atoi(),exit()
#include<io.h> // eof()
#include<math.h> // 数学函数头文件
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
typedef int Status; // Status是函数的类型,其值是函数结果状态代码
#define MAX_QSIZE 100 // 最大队列长度+1
#define N 2
typedef int QElemType;
typedef struct
{
char name[20];
char id[20];
int x;
int y;
int z;
}point;
typedef struct
{ point* base; // 初始化的动态分配存储空间
int front; // 头指针,若队列不空,指向队列头元素
int rear; // 尾指针,若队列不空,指向队列尾元素的下一个位置
}SqQueue;

void InitQueue(SqQueue &Q)
{ // 构造一个空队列Q
Q.base=(point *)malloc(MAX_QSIZE *sizeof(point));
if(!Q.base) // 存储分配失败
exit(OVERFLOW);
Q.front=Q.rear=0;
}

Status QueueEmpty(SqQueue Q)
{ // 若队列Q为空队列,则返回TRUE;否则返回FALSE
if(Q.front==Q.rear) // 队列空的标志
return TRUE;
else
return FALSE;
}

Status EnQueue(SqQueue &Q,point e)
{ // 插入元素e为队列Q的新的队尾元素
if((Q.rear+1)%MAX_QSIZE==Q.front) // 队列满
return ERROR;
Q.base[Q.rear]=e; // 将e插在队尾
Q.rear=(Q.rear+1)%MAX_QSIZE; // 队尾指针+1后对MAX_QSIZE取余
return OK;
}

int QueueLength(SqQueue Q)
{ // 返回队列Q的元素个数,即队列的长度
return(Q.rear-Q.front+MAX_QSIZE)%MAX_QSIZE;
}

int DeQueue(SqQueue &Q,point &e)
{ // 若队列Q不空,则删除Q的队头元素,用e返回其值,并返回OK;否则返回ERROR
if(Q.front==Q.rear) // 队列空
return ERROR;
e=Q.base[Q.front]; // 将队头元素的值赋给e
Q.front=(Q.front+1)%MAX_QSIZE; // 移动队头指针
return OK;
}

void QueueTraverse(SqQueue Q)
{ // 从队头到队尾依次对队列Q中每个元素输出
int i=Q.front; // i最初指向队头元素
point e=Q.base[i];//把i指向的元素赋给e
while(i!=Q.rear) // i指向队列Q中的元素
{
printf("name:%s id=%s x=%d y=%d z=%d\n",e.name,e.id,e.x,e.y,e.z); // 输出i所指元素
i=(i+1)%MAX_QSIZE; // i指向下一个元素
}
printf("\n");
}
int main()
{
int i;
SqQueue Q;
InitQueue(Q);
point p[N];
for(i=1;i<=N;i++)
{
printf("Input the %dth point's name id x y z ",i);
scanf("%s %s %d %d %d",p[i].name,p[i].id,&p[i].x,&p[i].y,&p[i].z);
EnQueue(Q,p[1]);
}
QueueTraverse(Q);
system("pause");
return 0;
}追问

这个是在vs2017中新建项目之后直接出现的界面,请问在写代码的时候直接在括号里面写就可以了么

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