新人求助,第一次用VC6.0,运行不出,HELP!!
程序代码: /* algo3-1.c 调用算法3.1的程序 */
typedef int SElemType; /* 定义栈元素类型为整型 */
# include "c1.h"
# include "c3-1.h" /* 采用顺序栈 */
# include "bo3-1.c" /* 利用顺序栈的基本操作 */
void conversion() /* 算法3.1 */
{ /* 对于输入的任意一个非负十进制整数,打印输出与其等值的八进制数 */
SqStack s;
unsigned n; /* 非负整数 */
SElemType e;
InitStack(&s); /* 初始化栈 */
printf("n(>=0)=");
scanf("%u",&n); /* 输入非负十进制整数n */
while(n) /* 当n不等于0 */
{
Push(&s,n%8); /* 入栈n除以8的余数(8进制的低位) */
n=n/8;
}
while(!StackEmpty(s)) /* 当栈不空 */
{
Pop(&s,&e); /* 弹出栈顶元素且赋值给e */
printf("%d",e); /* 输出e */
}
printf("\n");
}
void main()
{
conversion();
}1、我对照严蔚敏的数据结构编写代码放VC里运行,编译的时候一直出错显示
程序代码:-------------------Configuration: ch3 - Win32 Debug--------------------
Compiling...
algo3-1.c
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(4) : error C2065: 'SElemTpye' : undeclared identifier
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(4) : error C2059: syntax error : ')'
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(12) : error C2061: syntax error : identifier 'DestroyStack'
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(12) : error C2059: syntax error : ';'
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(12) : error C2059: syntax error : 'type'
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(29) : error C2065: 'TURE' : undeclared identifier
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(37) : error C2143: syntax error : missing ';' before '}'
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(39) : error C2143: syntax error : missing ')' before '*'
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(39) : error C2081: 'SElemTpye' : name in formal parameter list illegal
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(39) : error C2143: syntax error : missing '{' before '*'
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(39) : error C2059: syntax error : ')'
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(40) : error C2054: expected '(' to follow 'e'
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(50) : error C2146: syntax error : missing ')' before identifier 'e'
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(50) : error C2081: 'SElemTpye' : name in formal parameter list illegal
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(50) : error C2061: syntax error : identifier 'e'
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(50) : error C2059: syntax error : ';'
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(50) : error C2059: syntax error : ')'
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(51) : error C2449: found '{' at file scope (missing function header?)
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(54) : error C2018: unknown character '0xa3'
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(54) : error C2018: unknown character '0xbb'
d:\program files\microsoft visual studio\myprojects\ch3\bo3-1.c(62) : error C2059: syntax error : '}'
D:\Program Files\Microsoft Visual Studio\MyProjects\ch3\algo3-1.c(17) : warning C4013: 'Push' undefined; assuming extern returning int
D:\Program Files\Microsoft Visual Studio\MyProjects\ch3\algo3-1.c(22) : warning C4013: 'Pop' undefined; assuming extern returning int
执行 cl.exe 时出错.
algo3-1.obj - 1 error(s), 0 warning(s)我很迷惑啊,它第一行就显示“SElemTpye' : undeclared identifier”,但是SElemTpye不是在开头就已经用typedef定义过了??后面的是什么问题我也不清楚,这个到底是怎么回事呢?
2、还有,我用VC编译这个程序的时候还会出现停不下来,退出也退不出,点击BuildStop也不行,只能通过任务管理器强制退出……这个VC使用着怎么那么不爽啊








hehe iay努力

