#include "stdio.h" #define maxsize 50 typedef int elemtype;
typedef struct {elemtype data[maxsize]; int front,rear; } queue; elemtype e;
/***********************************************/ void init_queue(queue *h) {h->front=h->rear=0; } /********************************************/ int empty_queue(queue h) {return h.front==h.rear;} /********************************************/ int full_queue(queue h) {return (h.rear+1)%maxsize==h.front;} /********************************************/ void append_queue(queue *p) {int i,n,line; clrscr(); line=10; gotoxy(20,line); printf("How many numbers which you will append ?"); scanf("%d",&n); i=0; while(i<n) { if(full_queue(*p)) {clrscr(); gotoxy(16,11); printf("Sorry ! The queue is full ! Cann't append it!"); break; } else { line=line+2; if(line>24) {clrscr();line=2;} gotoxy(20,line); printf("Please input NO.%d number:",i+1); scanf("%d",&e); p->rear=(p->rear+1)%maxsize; p->data[p->rear]=e; } i++; } getch(); } /*****************************************************/ void output(queue h) {int i,num=0; clrscr(); gotoxy(20,10); if(empty_queue(h)) printf("Sorry ! The queue is emtpy ! "); else {printf(" "); for(i=h.front;i!=h.rear;) {i=(i+1)%maxsize; printf("%5d",h.data[i]);num++; if(num%10==0)printf(" "); } } gotoxy(20,22); printf("Press Any key to Return ."); getch(); } /********************************************/ void delete_queue(queue *h) { clrscr(); gotoxy(20,11); if(empty_queue(*h)) printf("Sorry ! The queue is emtpy ! "); else { e=h->data[h->front+1]; h->front=(h->front+1)%maxsize; printf("The element that came out is %d. ",e); } getch(); } /********************************************/ void getelem(queue h,elemtype *p) { clrscr(); gotoxy(20,11); if(empty_queue(h)) printf("Sorry ! The queue is emtpy ! "); else { *p=h.data[h.front+1]; printf("The elemment which you get is %d.",*p); } getch(); } /********************************************/ void quit() { clrscr(); gotoxy(20,12); printf("e use it again ! "); getch(); exit(0); } /********************************************/ void main() { int n; queue qe; init_queue(&qe);
while(1) {clrscr(); gotoxy(20,7); printf(" ===== menu ===== "); gotoxy(20,9); printf("******************************** "); gotoxy(20,10);printf("* 1. append 2. deleted * "); gotoxy(20,11);printf("* 3. getelem 4. output * "); gotoxy(20,12);printf("* 0. quit * "); gotoxy(20,13);printf("******************************** "); gotoxy(20,16); printf("Please input your choice : "); scanf("%d",&n); while(n<0||n>4) {printf(" Input Error ! Please input again ! "); scanf("%d",&n); } switch(n) {case 1:append_queue(&qe); break; case 2:delete_queue(&qe); break; case 3:getelem(qe,&e); break; case 4:output(qe); break; case 0:quit(); } } }
最近看到群里的不少网友在搭建大数据内容网站,内容量有百万篇幅,包括图片可能有超过50GB,如果一台服务器有需要多个站点的话,那肯定默认的服务器50GB存储空间是不够用的。如果单独在购买数据盘会成本提高不少。这里我们看到腾讯云促销活动中有2款带大数据盘的套餐还是比较实惠的,一台是400GB数据盘,一台是800GB数据盘,适合他们的大数据网站。 直达链接 - 腾讯云 大数据盘套餐服务器这里我们看到当前...
Hostodo商家算是一个比较小众且运营比较久的服务商,而且还是率先硬盘更换成NVMe阵列的,目前有提供拉斯维加斯和迈阿密两个机房。看到商家这两年的促销套餐方案变化还是比较大的,每个月一般有这么两次的促销方案推送,可见商家也在想着提高一些客户量。毕竟即便再老的服务商,你不走出来让大家知道,迟早会落寞。目前,Hostodo有提供两款大流量的VPS主机促销,机房可选拉斯维加斯和迈阿密两个数据中心,且都...
目前国内云计算市场竞争异常激烈,尤其是国内的腾讯云、阿里云、景安等商家促销活动一波接一波的进行,对于有需要的用户确实得到不小的实惠。但是这样给予国内的主机商确实是比较大的打击,毕竟这些商家的背景和实例强劲,即便是贴本补贴优惠,也是不怕的。前两年阿里一家各种活动促销,确实在国内市场占据主要的市场地位,腾讯云开始两年没有较大的吸引用户,不过这两年的发展还是比较稳健的。我们很多网友在之前肯定也享受到一些...