C语言 运行错误

// we.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
#include "stdafx.h"
#include <stdlib.h>
int main()
{ int i,sum=0,a,total;
for(i=1;i<=5;i++)
{ printf("please enter a number\n");
scanf("%d",&a);
sum=sum+a;
if(total>7)break;
}
printf("%d\n",sum);
system("pause");
}

你这里2个main函数了吗?模板生成的那些你删了,或是在提示的位置加上你的代码啊

你复制我改的,全部替换这个文件的内容:
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i, sum = 0, a, total;
for (i = 1; i <= 5; i++)
{
printf("please enter a number\n");
scanf("%d", &a);
sum = sum + a;
if (total > 7)
break;
}
printf("%d\n", sum);
system("pause");
return 0;
}
温馨提示:答案为网友推荐,仅供参考
相似回答