请问下面的while(1)和while(head)分别是什么意思啊?#include struct Student{ long num;float score;Student* next;};Student* pHead=NULL; //链首指针void Create(){ Student* pS; //当前插入的结点指针Student* pEnd; //链尾指
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/17 17:58:00
请问下面的while(1)和while(head)分别是什么意思啊?
#include
struct Student
{ long num;
float score;
Student* next;
};
Student* pHead=NULL; //链首指针
void Create()
{ Student* pS; //当前插入的结点指针
Student* pEnd; //链尾指针
pS=new Student; //为第一个结点动态开辟堆内存
cin>>pS->num>>pS->score; //给第一个结点赋值
pHead=pS; //链首指针指向第一个结点
pEnd=pS; //链尾指针指向第一个结点
while(1)
{ pS=new Student; //下一个结点
cin>>pS->num>>pS->score;
if(pS->num==0)
break;
pEnd->next=pS; //原结点
pEnd=pS; //新结点
}
pEnd->next=NULL; //最后结点指针
delete pS;
}
void ShowList(Student* head)
{ cout
while(1)表示从键盘输入来构建链表,直到用户输入num值为0时终止输入.
while(head)表示链表不为空而且没有到达链表尾部时将链表的值输出到标准输出设备(屏幕).
请问while和for的区别在哪?while (i)这是什么意思?while(i);和for(i=1;i
C语言while()和while();的区别.
和while的用法!
while(1){ } 即 WHILE(1);
请问在单片机C语言中,while(--t)和while(t--)有什么区别啊?
C语言的初级上机题,分别利用for、while和do…while语句完成下面的程序.求1+3+5+7+…+99的和.
for a while 和 after a while 和once in a while 和 all the while的意思 和区别(求详解)
请问:while的用法和意义有哪些?
while(!
while
while(!
while
请问下面的while(1)和while(head)分别是什么意思啊?#include struct Student{ long num;float score;Student* next;};Student* pHead=NULL; //链首指针void Create(){ Student* pS; //当前插入的结点指针Student* pEnd; //链尾指
请问when 和while (表示当.的时候)有什么区别?简短的回答
分别用 while,do while 和for 循环计算1+2+……+100的和.
下面循环语句的循环体的循环次数是()i=1;while(i
While和When的区别?
when和while的区别