Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这个程序有什么问题,在List * creatlist(int n)这行有 错

Posted by hebeimoumoumou at 2011-02-23 23:20:17
#include<iostream.h>
#include<stdio.h>
class List
{
    int data;
    int *next;
}
list * creatlist(int n)
{ int n;
 List *p,*r,*list=NULL;
 int e;
 for(int i=0;i<n;i++)
  {cin>>e;
   p=(List*)malloc(sizeof(List));
   p->data=e;
   p->next=NULL;
   if(!list)
     list=p;
   else r->next=p;
   r=p;
  }
  return list
}
void main()
{
int n;
cin>>n;
cout<<creatlist(n)<<endl;
int *pt=creatlist(n);
for (int i1=0;i1<n;i1++)
   cout<<pt;
}
                        

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator