Joke Collection Website - Blessing messages - If you write a small program in TC 2.0, you will get 100 points if you are satisfied with it.
If you write a small program in TC 2.0, you will get 100 points if you are satisfied with it.
#include "stdio.h"
#include "iostream.h"
typedef struct node
{
long number;
node *next;
}seqlist;
printnode(seqlist*L)//Display the data in the linked list
{
seqlist *Node,*H;
H=L;
while(H->next)
{
printf("%d\n",H->next->number);
H=H->next;
}
p>
}
deletnode(seqlist*L)//Delete a node
{
long nu;
seqlist *Node,*H;
H=L;
printf("Enter the node to be deleted:");
cin>>nu;
while(H->next)
{
if(H->next->number==nu)
{
H->next=H->next->next;
break;
}
H=H->next ;
}
}
void creathead(seqlist*L)//Create a linked list
{
long nu;
seqlist *Node,*H;
H=L;
while(1)
{ p>
printf("Please enter student number (ends with 0):");
cin>>nu;
if(nu!=0)
{
Node=new node;
Node->number=nu;
H->next=Node;
Node->next=NULL;
H=H->next;
}
else break;
} p>
}
main()
{
seqlist *head;
head=new node;
head->next=NULL;
creathead(head);
printnode(head);
deletnode(head);
printnode(head);
}
3.#include "stdio.h"
#include "string.h"
struct student
{
char xm[20];
char xh[20];
char JG[ 15];
int CJ;
}dat[50],*p=dat;
int Add;
Input( )
{
int n=0;
int flag=1;
while(flag)
{
printf("Please Enter student number: ");
gets(dat[n].xh);
printf("Please enter name: ");
gets( dat[n].xm);
printf("Please enter your place of birth:");
gets(dat[n].JG);
printf ("Please enter the score:");
scanf("%d",&dat[n].CJ);
printf("Press 0 to stop input");
p>fflush(stdin);
scanf("%d",&flag);
if(flag==0)break;
else n++;
fflush(stdin);
}
Add=n;
}
sort ()
{
int i,j;
int tcj;
char txm[20],txh[20], tjg[20];
for(i=0;i for(j=1;j if(dat[i].CJ { tcj=dat[i]. CJ; dat[i].CJ=dat[i+1].CJ; dat[i+1].CJ=tcj; strcpy(txh,dat[i].xh); strcpy(dat[i].xh,dat[i+1].xh); strcpy(dat[i +1].xh,txh); strcpy(txm,dat[i].xm); strcpy(dat[i].xm,dat[i+1] .xm); strcpy(dat[i+1].xm,txm); strcpy(tjg,dat[i].JG); strcpy(dat[i].JG,dat[i+1].JG); strcpy(dat[i+1].JG,tjg); } < /p> } } main() { Input(); sort(); printf("Name\t\tStudent ID\t\tPlace of Birth\t\tGrade"); for(int i=0;i <=Add;i++) { printf("%s\t\t",dat[i].xm); printf(" %s\t\t",dat[i].xh); printf("%s\t\t",dat[i].JG); printf ("%d",dat[i].CJ); printf("\n"); } }
- Previous article:Congratulations on the party's birthday.
- Next article:What is the name of Roy's actor?
- Related articles
- Training plan scheme
- How to query the SMS sending record through Unicom's online business hall?
- The main function of love messages is to give unknown lovers.
- Contents of Cyber Security Publicity Week
- Icbc loan scam
- How did Jia Tianxin like Roy?
- How to write the bad review of the US group takeaway?
- What number did Taobao customers receive the text message?
- How should I express my concern when I have pneumonia?
- The blind date man was introduced by an acquaintance! I don't like him, I just told him! Very clear! But he still won't give up sending messages! He sent it to me, and I did it all.