#include<string>
using namespace std;
struct Student{
int num;
string name;
char sex;
float score;
}
void main()
{
cout<<"num is"<<endl;
cout<<"name is"<<endl;
cout<<"sex is"<<endl;
cout<<"score is"<<endl;
Student stu;
Student *p=&stu;
cin>>(*p).num>>(*p).name>>(*p).sex>>(*p).score;
cout<<(*p).num<<" "<<(*P).name<<" "<<(*p).sex<<" "<<(*p).score<<endl;
#define NULL 0
#include<iostream>
using namespace std;
struct Student{
long num;
float score;
struct Student *next;
}
int main()
{
Student a,b,c,*head,*p;
a.num=31001;a.score=39.5;
b.num=31003;b.score=90;
c.num=31007;c.score=85;
head=&a;
a.next=&b;
b.next=&c;
c.next=NULL;
p=head;
do
{cout<<p->num<<" "<<p->score<<endl;}
p=p->next;
while
p!=NULL;
return 0;
}
}
我是菜鸟,请问这两则程序哪里错了