C++程序设计的问题
//题目:《C++程序设计基础》2003年8月第一版
//5 cin string cout gnirts.
#include
#include
#include
struct code
{
char* str;
code*next ;
};
void main ( )
{
//char*str = new char;
char*a= new char;
cout << " input some string ."<gets(a);
int max = strlen(a);
cout << a[max-1]<code *head ;
//head = null;
//creatlist( ) ;
//printlist();
code* creatlist(char *a )
{
code *p,*s;
s = new code;
s->str = a[max-1];
head = s;
p = s;
int i;
for ( i=max-1;i>=0;i--)
{
s= new code ;
s->str = a[i];
p->next = s ;
p = s;
//absort(i>mas);
//adsort(i<0);
}
p->next = null;
delect s;
return head;
};
void printlist (code*head)
{
int i ;
for (i = 0;i{
cout str <<"\t";
hrad=head->next ;
}
}
}
我用C==6.0编译,
错误 是:
--------------------Configuration: 7box - Win32 Debug--------------------
Compiling...
5char.cpp
F:\C++\第五章\5char.cpp(37) : error C2601: 'creatlist' : local function definitions are illegal
F:\C++\第五章\5char.cpp(58) : error C2601: 'printlist' : local function definitions are illegal
Error executing cl.exe.
5char.obj - 2 error(s), 0 warning(s)
--------------------next---------------------
阅读(1176) | 评论(0) | 转发(0) |