当前位置:三九宝宝网 → 宝宝教育 → 教学论文 → 正文

c语言请帮忙找一下哪错了 while循环怎么结束不了

更新:02-22 整理:39baobao.com
字体:

[易语言ftp上传这段代码哪错了]..................................................很严重的错误啊 连接FTP服务器 (保密, 保密, 保密, , ) .如果 (连接FTP服务器 (保密, 保密, 保密, , ) = 真) 你连接两次干嘛?把如果上...+阅读

//改正,你运行一下吧

#include

#include

#include

struct accept

{

int vipnum;

int notvipnum;

int vip;

struct accept *next;

};

struct accept*head=NULL;

struct accept *creat(void) //创建接收客户请求的链表 (函数)

{

struct accept*currentptr=NULL,*lastptr=NULL;

currentptr=lastptr=(struct accept*)malloc(sizeof (struct accept));

printf("please choose wheather you are vip or not.\n");

printf("if you are a vip,please enter number 1.or you should enter number 0.\n");

scanf("%d",¤tptr->vip);

while(currentptr->vip!=2)

{

if(currentptr->vip==1)

currentptr->vipnum=100000;

else

currentptr->notvipnum=500000;

if(head==NULL)

head=currentptr;

else

{lastptr->next=currentptr;

lastptr=currentptr;

}

currentptr=(struct accept*)malloc(sizeof (struct accept));

printf("please choose wheather you are vip or not.\n");

printf("if you are a vip,please enter number 1.or you should enter number 0.\n");

scanf("%d",¤tptr->vip);

if(currentptr->vip==1)

currentptr->vipnum++;

else

currentptr->notvipnum++;

}

lastptr->next=NULL;

return head;

}

struct accept *print(struct accept *head)

{

struct accept *p;

p=head;

while(p->next!=NULL)

{

if(p->vip==1)

printf("%d\n",p->vipnum);

else

printf("%d\n",p->notvipnum);

p=p->next;

}

return 0;

}

struct accept *creat(void);

struct accept *print(struct accept *);

main()

{

head= creat();

print(head);

return 0;

}

本文地址:https://www.39baobao.com/show/29_44515.html

以上内容来自互联网,请自行判断内容的正确性。若本站收录的信息无意侵犯了贵司版权,请联系我们,我们会及时处理和回复,谢谢.

以下为关联文档:

C语言将10个数按从大到小排序帮忙看看拿哪错了 include#include<stdio.h> int main() { float arr[10],x; int i,j; for(i=0;i<10;i++) { scanf("%f",&arr[i]); } for(i=0;i<10;i++) { for(j=9;j>i;j--) { if(arr[i]<arr[j]) { x=a...

C语言考试题目请给位高手帮忙!谢谢第一题看输出结果应该是求圆周率的吧,记得圆周率的近似公式好象是PI/4≈1-1/3+1/5-1/7+1/9....楼主写错了吧 1、float fum( float num) { int s=1; float n=1.0,t=1,pi=0; wh...

求C语言库函数大全请大家帮忙谢了int isalpha(int ch) 若ch是字母('A'-'Z','a'-'z')返回非0值,否则返回0 int isalnum(int ch) 若ch是字母('A'-'Z','a'-'z')或数字('0'-'9') 返回非0值,否则返回0 int isascii(int ch...

哪位大神帮忙把下面c语言程序注释一下再详细解释一下!跪谢了注释就以C的注释格式加在源程序行后面吧: /* 这前面几行包含库文件和函数原型的定义就不用解释了吧 */ #include#includeint menu(void); void jiami(void); void (*ptr)(voi...

C语言的回调函数怎么用请帮忙举例说明看一下这个例子吧,我是这样理解的: #include "iostream.h" #include "windows.h" typedef void (CALLBACK *MyFun)(void);//回调函数定义 void CALLBACK callback() // 回调函数 { c...

C语言的50的阶乘不知道那错了请高人指点一、double最大有效位数16位,50的阶乘老长了,C中数值类变量都不可能运算、表示出来,只能采用大数相乘的方法,自己写运算程序去实现了。 二、你的程序太乱了 给你一个可运行的程...

帮忙解决一下C语言求日期差的问题!谢谢!main() { struct date date1,date2; int days,days1=0,days2=0; int daytab[]={31,28,31,30,31,30,31,31,30,31,30,31}; int i; //大概如此可能部分下标存在错误,自己调试修...

C语言考试题目请给位高手帮忙谢谢第一题看输出结果应该是求圆周率的吧,记得圆周率的近似公式好象是PI/4≈1-1/3+1/5-1/7+1/9....楼主写错了吧 1、float fum( float num) { int s=1; float n=1.0,t=1,pi=0; wh...

小班上学期语言教学计划帮忙找一下谢谢一、指导思想: 本学期我们将围绕《纲要》制定教学计划,在具体实施活动时也注重体会纲要精神。在课程领域划分方面,也以纲要为依据,分为语言、数学、生活与健康、科学、艺术以及...