當前位置:首頁 » 編程語言 » c語言中修改個人信息的代碼
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

c語言中修改個人信息的代碼

發布時間: 2022-10-01 19:51:28

c語言,定義一種結構類型,能實現一個人的姓名,年齡,身高,體重信息

代碼:

#include<stdio.h>
structpeople{
charname[10];
intage;
inthigh;//單位cm
floatweight;//單位kg
}p;

intmain(){
printf("請輸入您的姓名、年齡、身高cm、體重kg(空格分開): ");
scanf("%s%d%d%f",&p.name,&p.age,&p.high,&p.weight);
printf("您的個人信息:姓名:%s,年齡:%d歲,身高:%dcm,體重:%0.2fkg ",p.name,p.age,p.high,p.weight);
return0;
}

運行:

❷ 如何用C語言編寫自己的姓名和學號

用字元串保存就可以了

比如

intmain()
{
char*name="張三";
char*no="123456";
printf("姓名:%s 學號:%s ",name,no);

return0;
}

❸ 求C語言做通訊錄管理系統,系統功能有:輸入、刪除、修改、查詢和輸出聯系人信息功能,請附上簡要解釋

網路知道里一堆的相同問題,是不是學校的題庫都來源於同一個伺服器?

❹ 如何編寫C語言程序使得輸入編號就可以顯示其他的個人信息

1、寫一個結構體數組用來記錄信息

這里我寫了一個可以存儲一個人的姓名、電話、郵箱的結構體。

structnote{
charname[100];
charphone[100];
charmail[100];
}people[1000];

2、用文件儲存更加方便

p=fopen("list.txt","r");
if(p==NULL)
{
fclose(p);
p=fopen("list.txt","w");
fclose(p);
}

3、寫一個簡單的界面(可以用死循環)

while(1)
{
n=0;
p=fopen("list.txt","r");
while(fscanf(p,"%s%s%s",people[n].name,people[n].phone,people[n].mail)!=EOF)
n++;
fclose(p);
///--------一次循環更新一次數據

4、寫一個簡單的查找程序

intk;
cout<<"輸入1讀取,輸入2輸入"<<endl;
cin>>k;
if(k==1)
{
cout<<"輸入信息"<<endl;
chars[100];
cin>>s;
boolok=0;
for(i=0;i<strlen(s);i++)
if(s[i]>='0'&&s[i]<='9')
ok=1;
//自動識別輸入的是姓名還是電話號碼
if(ok==0)
{
//cout<<"通過姓名找到聯系人"<<endl;
//system("pause");
boolyou=0;
for(i=0;i<n;i++)
if(strcmp(s,people[i].name)==0)
{
you=1;
cout<<"姓名"<<people[i].name<<endl;
cout<<"電話號碼"<<people[i].phone<<endl;
cout<<"郵箱"<<people[i].mail<<endl;
}
if(you==0)
cout<<"沒有通過姓名找到聯系人"<<endl;
}
if(ok==1)
{
//cout<<"通過電話找聯系人"<<endl;
//system("pause");
boolyou=0;
for(i=0;i<n;i++)
if(strcmp(s,people[i].phone)==0)
{
you=1;
cout<<"姓名"<<people[i].name<<endl;
cout<<"電話號碼"<<people[i].phone<<endl;
cout<<"郵箱"<<people[i].mail<<endl;
}
if(you==0)
cout<<"沒有通過電話找到聯系人"<<endl;
}

5、添加信息的代碼

if(k==2)
{
p1=fopen("list.txt","a+");
charss[1000];
cout<<"請輸入姓名"<<endl;
cin>>ss;
fprintf(p1,"%s ",ss);
cout<<"請輸入電話"<<endl;
cin>>ss;
fprintf(p1,"%s ",ss);
cout<<"請輸入郵箱"<<endl;
cin>>ss;
fprintf(p1,"%s ",ss);
fclose(p1);
}
}

最終的程序

#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cmath>
usingnamespacestd;
FILE*p,*p1;
structnote{
charname[100];
charphone[100];
charmail[100];
}people[1000];
intmain()
{
intn=0,i,j;
p=fopen("list.txt","r");
if(p==NULL)
{
fclose(p);
p=fopen("list.txt","w");
fclose(p);
}
while(1)
{
n=0;
p=fopen("list.txt","r");
while(fscanf(p,"%s%s%s",people[n].name,people[n].phone,people[n].mail)!=EOF)
n++;
fclose(p);
///---------------
intk;
cout<<"輸入1讀取,輸入2輸入"<<endl;
cin>>k;
if(k==1)
{
cout<<"輸入信息"<<endl;
chars[100];
cin>>s;
boolok=0;
for(i=0;i<strlen(s);i++)
if(s[i]>='0'&&s[i]<='9')
ok=1;
if(ok==0)
{
//cout<<"通過姓名找到聯系人"<<endl;
//system("pause");
boolyou=0;
for(i=0;i<n;i++)
if(strcmp(s,people[i].name)==0)
{
you=1;
cout<<"姓名"<<people[i].name<<endl;
cout<<"電話號碼"<<people[i].phone<<endl;
cout<<"郵箱"<<people[i].mail<<endl;
}
if(you==0)
cout<<"沒有通過姓名找到聯系人"<<endl;
}
if(ok==1)
{
//cout<<"通過電話找聯系人"<<endl;
//system("pause");
boolyou=0;
for(i=0;i<n;i++)
if(strcmp(s,people[i].phone)==0)
{
you=1;
cout<<"姓名"<<people[i].name<<endl;
cout<<"電話號碼"<<people[i].phone<<endl;
cout<<"郵箱"<<people[i].mail<<endl;
}
if(you==0)
cout<<"沒有通過電話找到聯系人"<<endl;
}

}
if(k==2)
{
p1=fopen("list.txt","a+");
charss[1000];
cout<<"請輸入姓名"<<endl;
cin>>ss;
fprintf(p1,"%s ",ss);
cout<<"請輸入電話"<<endl;
cin>>ss;
fprintf(p1,"%s ",ss);
cout<<"請輸入郵箱"<<endl;
cin>>ss;
fprintf(p1,"%s ",ss);
fclose(p1);
}
}
return0;
}

❺ 用c語言編寫一個通訊錄,並對他進行增加,查詢,刪除,修改,顯示記錄等操作,要寫出源代碼並畫出流程圖

這個是我編的,用數組和鏈表兩種功能實現的通訊錄
基本能滿足你的要求!!

代碼如下:
#include "stdlib.h"
#define NEW (struct node *)malloc(sizeof(struct node))
struct student
{ char name[10],tel[11];
}a[20];
struct node
{ char name[20],tel[11];
struct node *next;
};
main()
{ struct student *jianli(),*delete(struct student *);
struct student *charu(struct student *);
void xianshi(struct student *);
struct node *create(),*delnode(struct node*,char *);
struct node *insert(struct node *,struct node *,char *);
void prlist(struct node *);
struct student *p;
struct node *head=NULL,*stu;
char s[80],name[20],q[80];
int c,w;
a:;
system("cls");
printf("\nEnter your choice\n");
printf("1.SHUZU\n2.LIANBIAO\n0.Quit\n");
gets(q);
w=atoi(q);
switch(w)
{ case 1:
do
{ do
{ printf("----------------------------------------------\n");
printf("******************Phone book******************\n");
printf("----------------------------------------------\n");
printf(" | | <1> Add a note | |\n");
printf(" | | <2> Show the list | |\n");
printf(" | | <3> Delete a note | |\n");
printf(" | | <4> Insert a note | |\n");
printf(" | | <0> Quit | |\n");
printf("----------------------------------------------\n");
printf(" Enter your choice(0-4):");
gets(s);
c=atoi(s);
}while(c<0||c>4);
system("cls");
switch(c)
{ case 1: p=jianli();break;
case 2: xianshi(p);break;
case 3: printf("\nPlease input the name to deleted\n");
p=delete(p);break;
case 4: printf("\nPlease input the new name\n");
p=charu(p);break;
}
}while(c);goto a;
case 2:
do
{ do
{printf("----------------------------------------------\n");
printf("******************Phone book******************\n");
printf("----------------------------------------------\n");
printf(" | | <1> Add a note | |\n");
printf(" | | <2> Show the list | |\n");
printf(" | | <3> Delete a note | |\n");
printf(" | | <4> Insert a note | |\n");
printf(" | | <0> Quit | |\n");
printf("----------------------------------------------\n");
printf(" Enter your choice(0-4):");
gets(s);
c=atoi(s);
}while(c<0||c>4);
system("cls");
switch(c)
{ case 1: head=create();break;
case 2: prlist(head);break;
case 3: printf("\nInput the name to deleted\n");
gets(name);
head=delnode(head,name);break;
case 4: stu=NEW;
printf("\nInput the new node\n");
printf("name:");
gets(stu->name);
printf("tel:");
gets(stu->tel);
stu->next=NULL;
printf("\nInsert position\n");
printf("name:");
gets(name);
head=insert(head,stu,name);
}
}while(c);goto a;
}
}
#include "string.h"
struct student *jianli()
{ char c1[10],c2[11];
int i=0;
printf("name:");
gets(c1);
while(strlen(c1)!=0)
{ strcpy(a[i].name,c1);
printf("tel:");
gets(c2);
strcpy(a[i].tel,c2);
i++;
printf("name:");
gets(c1);
}
return a;
}
#include "string.h"
struct student *delete(struct student *p)
{ char c1[10];
int i=0,j,l=0;
while(strlen(p[i].name)!=0)
i++;
printf("name:");
gets(c1);
for(j=0;j<=i+1;j++)
if(strcmp(c1,p[j].name)==0)
{p[j]=p[j+1];
l=j;}
while(l<i+1)
{p[l]=p[l+1];
l++;}
return p;
}
#include "string.h"
struct student *charu(struct student *p)
{ char c1[10],c2[11];
int i=0;
while(strlen(p[i].name)!=0)
i++;
printf("name:");
gets(c1);
strcpy(p[i].name,c1);
printf("tel:");
gets(c2);
strcpy(p[i].tel,c2);
return p;
}
#include "string.h"
void xianshi(struct student *p)
{ int i=0;
printf("name\ttel\n\n");
while(strlen(p[i].name)!=0)
{ printf("%s\t%s\n",p[i].name,p[i].tel);
i++;}
}
#include "stdlib.h"
#include "string.h"
#define NEW (struct node *)malloc(sizeof(struct node))
struct node *create()
{ struct node *h;
struct node *p,*q;
char name[20];
h=q=NULL;
printf("name:");
gets(name);
while(strlen(name)!=0)
{ p=NEW;
if(p==NULL)
{ printf("Allocation failure\n");
exit(0);
}
strcpy(p->name,name);
printf("tel:");
gets(p->tel);
p->next=NULL;
if(h==NULL)
h=p;
else
q->next=p;
q=p;
printf("name:");
gets(name);
}
return h;
}
struct node *insert(struct node *head,struct node *p0,char *x)
{ struct node *p,*q;
if(head==NULL)
{ head=p0;
p0->next=NULL;
}
else
{ p=head;
while(strcmp(x,p->name)!=0&&p->next!=NULL)
{ q=p;p=q->next;}
if(strcmp(x,p->name)==0)
{ if(p==head)
head=p0;
else
q->next=p0;
p0->next=p;
}
else
{ p->next=p0;
p0->next=NULL;
}
}
return head;
}
void prlist(struct node *head)
{ struct node *p;
p=head;
printf("name\ttel\n\n");
while(p!=NULL)
{ printf("%s\t%s\n",p->name,p->tel);
p=p->next;
}
}
struct node *delnode(struct node *head,char *x)
{ struct node *p,*q;
if(head==NULL)
{ printf("this is a empty list.");
return head;
}
p=head;
while(strcmp(x,p->name)!=0&&p->next!=NULL)
{ q=p;p=p->next;}
if(strcmp(x,p->name)==0)
{ if(p==head)
head=p->next;
else
q->next=p->next;
free(p);
}
else
printf("Not found.");
return head;
}

❻ 用c語言編寫通訊錄

自己寫的,看一下

// 頭文件部分

//============================
#include <stdio.h>
#include <windows.h>
#include <stdlib.h>

#include <conio.h>

// 初始化數據部分
int Menu();
void Start();
void Write();
void Read();
void Search();
void Detele();
void beauty();
void Rework();
void Lock();
int Judge();
//============================
struct Student{
char name[20];
char Tel[20];
char QQ[20];
int age;
}xy[100];
char wenjian[10000];
char Number[10];
char number=0;
int GOTO;
//
int main()
{
Start();
for(;;)
{
GOTO=Menu();
if(GOTO==1)
{
for(;;)
{
Write();
int judge=Judge();
if(judge==2)
{
break;
}
}
}
if(GOTO==2)
{
for(;;)
{
Read();
system("pause");
break;
}
}
if(GOTO==3)
{
for(;;)
{
Search();
int judge=Judge();
if(judge==2)
{
break;
}
}
}
if(GOTO==4)
{
for(;;)
{
Rework();
int judge=Judge();
if(judge==2)
{
break;
}
}
}
if(GOTO==5)
{
Detele();
break;
}
if(GOTO==6)
{
beauty();
break;
}
if(GOTO==7)
{
}
if(GOTO==8)
{
printf("");
break;
}
if(GOTO==9)
{
printf("\t\t\t退出系統\n\n");
return 0;
}
if(GOTO==0)
{
printf("");
break;
}
}
// beauty();
//
// Write();
// Read();
// Search();
// Rework();
// Detele();
return 0;
}

void Write()
{
printf("\t\t\t請輸入好友名字\n");
scanf("%s",&xy[number].name);
printf("\t\t\t請輸入好友電話號碼\n");
scanf("%s",&xy[number].Tel);
printf("\t\t\t請輸入好友QQ號碼\n");
scanf("%s",&xy[number].QQ);
printf("\t\t\t請輸入好友年齡\n");
scanf("%d",&xy[number].age);

FILE *file;
if((file=fopen("Friend.txt","rt"))==NULL)
{
file=fopen("Friend.txt","wt");
fprintf(file,"%-20s%-20s%-20s%-20s","姓名","電話","QQ","年齡");
}
file=fopen("Friend.txt","at");
fprintf(file,"%-20s%-20s%-20s%-20d\n",xy[number].name,xy[number].Tel,xy[number].QQ,xy[number].age);
fclose(file);
number++;
Number[0]=number;
FILE * Sta;
if((Sta=fopen("number.txt","r"))=NULL)
{
Sta=fopen("number.txt","wt");
exit(1);
}
Sta=fopen("number.txt","wt");
fprintf(Sta,"%d",Number[0]);

fclose(Sta);
}

void Read()
{
printf("\t\t\t您通訊錄中一共有%d位好友\n",Number[0]);

FILE* read;
if((read=fopen("Friend.txt","r"))=NULL)
{
printf("\t\t\t您通訊中當前沒有好友,請返回添加\n");
}
read=fopen("Friend.txt","rt");
printf("%-20s%-20s%-20s%-20s\n","姓名","電話 ","QQ","年齡");
for(int i=0;i<number;i++)
{

fscanf(read,"%s%s%s%d\n",&xy[i].name,&xy[i].Tel,&xy[i].QQ,&xy[i].age);

printf("%-20s%-20s%-20s%-20d\n",xy[i].name,xy[i].Tel,xy[i].QQ,xy[i].age);

}
/* fread(wenjian,10000,1,read);
for(int i=0;i<number*80+80;i++)
{
printf("%c",wenjian[i]);

}
printf("\n");
*/

fclose(read);
}

void beauty()
{

int d;
do{
printf("choose");
scanf("%d",&d);
}while(d<1&&d>5);
if(d==1)
{
system("color 27");
printf("===1===");

}
if(d==2)
{
system("color 37");
printf("===2===");
}
if(d==3)
{
system("color 47");
printf("===3===");
}
if(d==4)
{
system("color 57");
printf("===4===");
}
if(d==5)
{
system("color 67");
printf("===5===");
}

}
void Start()
{
FILE* Start;
if((Start=fopen("number.txt","r"))==NULL)
{
Start=fopen("number.txt","w");
number=0;
Number[0]=number;
fscanf(Start,"%d",&Number[0]);
printf("\t\t\t您的通訊錄中還沒有任何好友,趕快添加吧.此次操作需要重新運行程序。\n");
exit(1);
}
Start=fopen("number.txt","r");
fscanf(Start,"%d",&Number[0]);

number=Number[0];

fclose(Start);

}

void Search()
{
int change=0;
char Searchname[20];
printf("\t\t\t輸入要查找的好友的名字\n\n");
scanf("%s",&Searchname);
fflush(stdin);
printf("\t\t\t您要查找的好友是 %s \n\n",Searchname);

FILE *Search;
Search=fopen("Friend.txt","rt");

for(int i=0;i<=number;i++)
{

fscanf(Search,"%s%s%s%d\n",&xy[i].name,&xy[i].Tel,&xy[i].QQ,&xy[i].age);

if(strcmp(xy[i].name,Searchname)==0)
{
printf("\t\t\t下面是該好友的信息:\n\n");
printf("%-20s%-20s%-20s%-20s\n","姓名","電話 ","QQ","年齡");
printf("%-20s%-20s%-20s%-20d\n",&xy[i].name,&xy[i].Tel,&xy[i].QQ,xy[i].age);
change=1;
}

fclose(Search);
}
if(change==0)
{
printf("\t\t\t您要查找的好友不存在,請返回菜單添加。\n");
}
}

void Rework()
{
char Rework[20];
printf("\t\t\t輸入要修改的好友的名字\n\n");
scanf("%s",&Rework);

printf("\t\t\t您要修改 %s 的信息\n\n",Rework);
int Change=0;
FILE *Search;
Search=fopen("Friend.txt","rt");

for(int i=0;i<=number;i++)
{

fscanf(Search,"%s%s%s%d\n",&xy[i].name,&xy[i].Tel,&xy[i].QQ,&xy[i].age);

if(strcmp(xy[i].name,Rework)==0)
{
printf("\t\t\t下面是該好友的信息:\n\n");
printf("%-20s%-20s%-20s%-20s\n","姓名","電話 ","QQ","年齡");
Change=1;
int Choose;
printf("%-20s%-20s%-20s%-20d\n",&xy[i].name,&xy[i].Tel,&xy[i].QQ,xy[i].age);
//---------------------------------------------------------------------
do
{
printf("\t\t\tchoose\t\t\t1-----3");

scanf("%d",&Choose);
}while(Choose>3||Choose<1);
if(Choose==1){

printf("\t\t\t請輸入好友電話號碼\n");
scanf("%s",&xy[i].Tel);
}
if(Choose==2)
{
printf("\t\t\t請輸入好友QQ號碼\n");
scanf("%s",&xy[i].QQ);
}
if(Choose==3)
{
printf("\t\t\t請輸入好友年齡\n");
scanf("%d",&xy[i].age);
}

Search=fopen("Friend.txt","wt");
for(int sta=0;sta<i;sta++)
{
fprintf(Search,"%-20s%-20s%-20s%-20d\n",xy[sta].name,xy[sta].Tel,xy[sta].QQ,xy[sta].age);
}
if(sta==i)
{
fprintf(Search,"%-20s%-20s%-20s%-20d\n",xy[i].name,xy[i].Tel,xy[i].QQ,xy[i].age);
i++;
}
for(i;i<=number;i++)
{
fprintf(Search,"%-20s%-20s%-20s%-20d\n",xy[i].name,xy[i].Tel,xy[i].QQ,xy[i].age);
}
printf("\t\t\t修改後的信息為:\n\n");
Read();

}

fclose(Search);
}
if(Change==0)
{
printf("\t\t\t您要查找的好友不存在,請返回菜單添加。\n");
}
}
void Detele()
{

int change=0;
char delete_friend[20];
printf("\t\t\t輸入要刪除的好友的名字\n\n");
scanf("%s",&delete_friend);
fflush(stdin);
printf("\t\t\t您要刪除的好友是 %s \n\n",delete_friend);

FILE *DeleteF;
DeleteF=fopen("Friend.txt","rt");

for(int i=0;i<=number;i++)
{

fscanf(DeleteF,"%s%s%s%d\n",&xy[i].name,&xy[i].Tel,&xy[i].QQ,&xy[i].age);

if(strcmp(xy[i].name,delete_friend)==0)
{
printf("\t\t\t下面是該好友的信息:\n\n");
printf("%-20s%-20s%-20s%-20s\n","姓名","電話 ","QQ","年齡");
printf("%-20s%-20s%-20s%-20d\n",&xy[i].name,&xy[i].Tel,&xy[i].QQ,xy[i].age);
change=1;

DeleteF=fopen("Friend.txt","wt");
for(int st=0;st<i;st++)
{
fprintf(DeleteF,"%-20s%-20s%-20s%-20d\n",xy[st].name,xy[st].Tel,xy[st].QQ,xy[st].age);

}
i++;
for(i;i<=number;i++)
{
printf("%-20s%-20s%-20s%-20d\n",xy[i].name,xy[i].Tel,xy[i].QQ,xy[i].age);
fprintf(DeleteF,"%-20s%-20s%-20s%-20d\n",xy[i].name,xy[i].Tel,xy[i].QQ,xy[i].age);
}
}
//--------------------------------------------------------------------------------

if(change==1)
{
printf("\t\t\t刪除後的通訊錄信息為:\n\n");

number--;
Number[0]=number;
FILE * St;
if((St=fopen("number.txt","r"))=NULL)
{
St=fopen("number.txt","wt");
exit(1);
}
St=fopen("number.txt","wt");
fprintf(St,"%d",Number[0]);

fclose(St);

fclose(DeleteF);
Start();
Read();
}
}

if(change==0)
{
printf("\t\t\t您要刪除的好友不存在。\n");
}

}

void Lock()
{

}

int Menu()
{
printf("\t\t*****歡迎進入通訊管理界面*****\n\n");

printf("\t\t\t1.添加我的好友\n");
printf("\t\t\t2.顯示所有好友\n");
printf("\t\t\t3.查找我的好友\n");
printf("\t\t\t4.修改好友信息\n");
printf("\t\t\t5.刪除我的好友\n");
printf("\t\t\t6.設置背景顏色\n");
printf("\t\t\t7.設置管理密碼\n");
printf("\t\t\t8.使用注意事項\n");
printf("\t\t\t9.退出通訊系統\n");
printf("\t\t\t0.作者想說的話\n");
printf("\t\t******************************\n\n");

do{
printf("\t\t\t請輸入你的選擇:\n\n");
scanf("%d",&GOTO);
}while(GOTO>9||GOTO<1);
return GOTO;
}

int Judge()
{
char JUDGE;
do
{
printf("\t\t\t是否繼續當前操作\n\n Y(yes) / N(no)\n");
printf("\t\t\t輸入你的選擇\n");
JUDGE=getch();
if(JUDGE=='y'||JUDGE=='Y')
{
return 1;
}
if(JUDGE=='n'||JUDGE=='N')
{
return 2;
}
}while(JUDGE!='y'||JUDGE!='n');

}

❼ c語言學生成績管理系統的刪除學生信息怎麼寫,求代碼

刪除學生信息你可以用一條其他信息來覆蓋這條要刪除的信息
這樣你的信息就不存在了 也就是刪除了
有疑問歡迎探討

❽ 用c語言寫職工信息系統.我寫的沒法修改信息!誰能幫我改一下這個子函數

子表 ( MADE IN 127 ) ***/
/*** ! 在程序運行過程中不要切換窗口,否則,會出錯 . ***/
#include<graphics.h>
#include<math.h>
#include<time.h>
#define STEP 6.283183/60
#define PI 3.141592
#define X 307
#define Y 150 /*** 中心坐標 ***/
#define R 100
#define R_OUT (R+4) /*** 內外半徑 ***/
#define R_S (R-20)
#define R_M (R-35)
#define R_H (R-50) /*** 各指針半徑 ***/
#define MIN 60 /*** 設定延時 (分鍾) ***/
#define C_I 9
int HH=0,MM=0;
main()
{
int gd=DETECT,gm,second,record_s,minite,record_m,hour,i,pc=60;
time_t t; float temp; char ch='#';
int int_M=MIN; pc=(MIN-int_M)*60;
initgraph (&gd,&gm,""); setbkcolor (0);
/*** 外觀設計 ***/
circle (X,Y,R); setfillstyle (1,2); floodfill (X,Y,15);
circle (X,Y,R_OUT); setfillstyle (1,8); floodfill (X+R_OUT-1,Y,15);
rectangle (X-2,Y-R+8-4,X+2,Y-R+8+4);
rectangle (X-2,Y+R-8-4,X+2,Y+R-8+4);
rectangle (X-R+8-4,Y-2,X-R+8+4,Y+2);
rectangle (X+R-8-4,Y-2,X+R-8+4,Y+2);
for (i=1;i<=60;i++)
if (i!=15&&i!=30&&i!=45&&i!=60)
if (i%5!=0) circle (X+(R-10)*cos(i*STEP),Y+(R-10)*sin(i*STEP),1);
else circle (X+(R-10)*cos(i*STEP),Y+(R-10)*sin(i*STEP),2);
rectangle (X+R_OUT,Y-6,X+R_OUT+6,Y+6);
setfillstyle (1,8); floodfill (X+R_OUT+3,Y,15);
temp=R_OUT*0.866;
line (X-R_OUT/2-5,Y-temp+2,X-R_OUT/2,Y-temp-30);
line (X-R_OUT/2+5,Y-temp-2,X-R_OUT/2+5,Y-temp-30);
line (X+R_OUT/2-5,Y-temp-2,X+R_OUT/2-5,Y-temp-30);
line (X+R_OUT/2+5,Y-temp+2,X+R_OUT/2,Y-temp-30);
line (X-R_OUT/2,Y-temp-30,X-R_OUT/2+5,Y-temp-30);
line (X+R_OUT/2-5,Y-temp-30,X+R_OUT/2,Y-temp-30);
line (X-R_OUT/2+5,Y-temp-25,X+R_OUT/2-5,Y-temp-25);
line (X-R_OUT/2+5,Y-temp-22,X+R_OUT/2-5,Y-temp-22);
floodfill (X-R_OUT/2-2,Y-temp,15);
floodfill (X+R_OUT/2+2,Y-temp,15);
floodfill (X,Y-R_OUT-10,15);
line (X-R_OUT/2-5,Y+temp-2,X-R_OUT/2,Y+temp+30);
line (X-R_OUT/2+5,Y+temp+2,X-R_OUT/2+5,Y+temp+30);
line (X+R_OUT/2-5,Y+temp+2,X+R_OUT/2-5,Y+temp+30);
line (X+R_OUT/2+5,Y+temp-2,X+R_OUT/2,Y+temp+30);
line (X-R_OUT/2,Y+temp+30,X-R_OUT/2+5,Y+temp+30);
line (X+R_OUT/2-5,Y+temp+30,X+R_OUT/2,Y+temp+30);
line (X-R_OUT/2+5,Y+temp+25,X+R_OUT/2-5,Y+temp+25);
line (X-R_OUT/2+5,Y+temp+22,X+R_OUT/2-5,Y+temp+22);
floodfill (X-R_OUT/2-2,Y+temp,15);
floodfill (X+R_OUT/2+2,Y+temp,15);
floodfill (X,Y+R_OUT+10,15);
for (i=1;i<=MIN*60+1;i++) /*** 該循環嚴格一秒一次 ( 捕捉系統時間 ) ***/
{
setcolor (15);
circle (X,Y,5); circle (X,Y,2); setfillstyle (1,0); floodfill (X,Y,15);
settextstyle (2,0,0); setcolor (8); outtextxy (X-13,Y-52,"FIYTA");
outtextxy (X-30,Y+35,"MADE IN 127"); setcolor (2);
time (&t); /*** 獲取系統時間 ***/
hour=(ctime(&t)[11]-'0')*10+(ctime(&t)[12]-'0');
minite=(ctime(&t)[14]-'0')*10+(ctime(&t)[15]-'0');
second=(ctime(&t)[17]-'0')*10+(ctime(&t)[18]-'0');
if (ch==C_I)
hour=(hour+HH)%24; minite=(minite+MM)%60;
window (22,22,80,22); printf (" The current time is ");
if (hour<10) printf ("0"); printf ("%d : ",hour);
if (minite<10) printf ("0"); printf ("%d : ",minite);
if (second<10) printf ("0"); printf ("%d",second);
window (35,20,80,20);
printf (" "); if (int_M<10) printf ("0"); printf ("%d : ",int_M);
if (pc<10) printf ("0"); printf ("%d ",pc);
record_m=minite;
hour=10*hour+minite/6-30;
minite=2*minite+second/30-30;
second-=15; record_s=second;
setcolor (0); /*** 寫指針 ***/
line (X+7*cos(PI+hour*STEP/2),Y+7*sin(PI+hour*STEP/2),X+R_H*cos(hour*STEP/2),Y+R_H*sin(hour*STEP/2));
setcolor (1);
line (X+13*cos(PI+minite*STEP/2),Y+13*sin(PI+minite*STEP/2),X+R_M*cos(minite*STEP/2),Y+R_M*sin(minite*STEP/2));
setcolor (4);
line (X+20*cos(PI+second*STEP),Y+20*sin(PI+second*STEP),X+R_S*cos(second*STEP),Y+R_S*sin(second*STEP)); record_s=second;
ch='#';
while (second==record_s) /*** 此循環用來 " 監視 " 系統秒針的變化 ***/
{
time (&t); second=(ctime(&t)[17]-'0')*10+(ctime(&t)[18]-'0')-15;
if (bioskey(1)&&(ch=getch())==C_I||ch==27)
{
if (ch==27)
window (22,22,80,22); printf (" PLS enter the time : ");
window (48,22,80,22);
while (!bioskey(1))

scanf ("%d:%d:%d",&HH,&MM);
if (HH<=23&&HH>=0&&MM>=0&&MM<=59) break; else
}
}
setcolor (2); /*** 覆蓋指針 ( 由秒控制 ) ***/
if ((record_m*60+60+second+15)%360==0||ch==C_I)
line (X+7*cos(PI+hour*STEP/2),Y+7*sin(PI+hour*STEP/2),X+R_H*cos(hour*STEP/2),Y+R_H*sin(hour*STEP/2));
if ((second+15)%30==0||ch==C_I)
line (X+13*cos(PI+minite*STEP/2),Y+13*sin(PI+minite*STEP/2),X+R_M*cos(minite*STEP/2),Y+R_M*sin(minite*STEP/2));
if (i!=60*MIN+1||ch==C_I)
line (X+20*cos(PI+record_s*STEP),Y+20*sin(PI+record_s*STEP),X+R_S*cos(record_s*STEP),Y+R_S*sin(record_s*STEP));
if (pc==0&&int_M!=0) pc=60; pc--; if (pc==59) int_M--;
}
window (20,22,80,22);
printf (" The watch time out! Press any key ... "); getch ();
closegraph ();
}

❾ c語言個人信息管理

c語言個人信息幫實現

❿ c語言學生信息管理系統代碼

代碼如下:

#include<stdio.h>
#include<malloc.h>
#include<stdlib.h>
#include<string.h>
#include<conio.h>
typedef struct examinee //考生信息結構
{ char examno[20]; //准考證號
char name[10]; //姓名
char sex[4]; //性別
short age; //年齡
char examtype[10]; //報考科目
}ElemType;

typedef struct Node //定義鏈表結點
{
ElemType data; //數據域
struct Node *next; //指針域
}Node,*List,*position;

List make_empty( List L ); //創建一個帶頭結點的空表
int is_empty( List L ); //測試鏈表是否是空表
int is_last( position p, List L ); //測試當前位置是否是表尾
position make_node( position p,int n ); //創建結點並輸入考生信息
void put_information( position p ); //是否輸出該考生信息
void put_name_information( List L ); //輸出姓名為xx的考生信息
int put_pos_information( position p ); //輸出該地址考生信息
void link_to_tail( List L, position p ); //將結點連接到表尾
int ciculation_make(); //循環創建考生信息
int judge_put_all(); //是否輸出所有考生信息
void put_all(List L); //輸出所有考生信息。
position find( List L ); //查找第一個姓名為xx的元素並返回位置
position find_previous( List L ); //查找第一個姓名為xx的元素並返回該元素直接前驅的位置
//int judge_delete_val(); //詢問是否刪除考生數據
int delete_val( List L ); //刪除指定考生信息並輸出其信息
void menu(List L); //菜單函數
List L;
//position p;

int
main( void )
{
List L = NULL; //定義頭結點指針
position p = NULL; //定義表工作指針
L = make_empty( L ); //創建空表
printf(" ★★考生報名管理程序★★ ---------------------------------------- ");
menu(L);
return 0;
}

//創建一個帶頭結點的空表
List
make_empty( List L)
{
L = ( List ) malloc (sizeof( Node ));
if(NULL == L)
{
printf("內存分配失敗");
exit( 1 );
}
L->next = NULL;
//printf("空表創建成功。 ");
return L;
}

//創建結點並輸入考生信息
position
make_node( position p ,int n)
{
if(n) //n為1是創建結點並輸入,n為0是修改
{
p = ( position ) malloc ( sizeof ( Node ));
p->next = NULL ;
}
printf("請輸入考生准考證號:");
gets(p->data.examno);
printf("請輸入考生姓名:");
gets(p->data.name);
do
{
printf("請輸入考生性別,只能輸入「男」或者「女」:");
gets(p->data.sex);
}
while( 0 != strcmp( p->data.sex, "男" ) && 0 != strcmp( p->data.sex, "女" )); //判斷性別是否有誤
printf("請輸入考生年齡:");
scanf("%hd",&p->data.age);
getchar(); //如果把這句刪掉,就「無法執行」下面的報考類別
/*下面的do while用來判斷報考類別是否輸入有誤*/
do
{
printf("請輸入報考類別,只能輸入「數學」或「英語」或者「數據結構」:");
gets(p->data.examtype);
}
while( 0 != strcmp( "英語", p->data.examtype ) && 0 != strcmp( "數學", p->data.examtype ) && 0 != strcmp( "數據結構", p->data.examtype ));
if(n)
{
printf("報名成功 ");
}
else
{
printf("修改成功 ");
}
return p;
}

//前插法;
void
link_to_tail( List L, position p)
{
p->next = L->next;
L->next = p;
}

//查找第一個姓名為xx的元素並返回位置
position
find( List L )
{
position p = L->next;
char name[10];
printf("請輸入你要查找的考生姓名:");
gets(name);
while( p != NULL && 0 != strcmp( p->data.name , name))
{
p=p->next;
}
return p;
}

//測試鏈表是否是空表
int
is_empty( List L )
{
return L->next == NULL;
}

//測試當前位置是否是表尾
int
is_last( position p, List L )
{
return p->next == NULL;
}

//輸出姓名為xx的考生信息
void
put_name_information( List L )
{
position p = find(L);
if(p!=NULL)
{
printf("您要查找的考生信息: ");
printf("准考證號:%s 姓名:%s 性別:%s 年齡:%hd 報考科目:%s ",p->data.examno,p->data.name,p->data.sex,p->data.age,p->data.examtype);
}
else
{
printf("沒有您要找的學生。 ");
}

}

//循環創建考生信息
int
ciculation_make()
{
int n = 2;
do
{
printf("是否繼續創建考生信息?是請輸入「1」,不是請輸入「0」:");
scanf("%d",&n);
getchar();
}
while( n != 0 && n != 1);
return n;
}

//是否輸出考生信息
void
put_information( position p )
{
int n=2;
do
{
printf("是否輸出該考生信息?是請輸入「1」,不是請輸入「0」:");
scanf("%d",&n);
getchar();
}
while( n != 0 && n != 1);
if(n)
{
printf("准考證號:%s 姓名:%s 性別:%s 年齡:%hd 報考科目:%s ",p->data.examno,p->data.name,p->data.sex,p->data.age,p->data.examtype);
}
}


//是否輸出所有考生信息
int
judge_put_all()
{
int n = 2;
do
{
printf("是否輸出所有考生信息?是請輸入「1」,不是請輸入「0」:");
scanf("%d",&n);
getchar();
}
while( n != 0 && n != 1);
return n;
}

//輸出所有考生信息
void
put_all(List L)
{
if(L->next == NULL)
{
printf("現無考生報名! ");
}
else
{
position p=L->next;
while( p != NULL )
{
printf("准考證號:%s 姓名:%s 性別:%s 年齡:%hd 報考科目:%s ",p->data.examno,p->data.name,p->data.sex,p->data.age,p->data.examtype);
p=p->next;
}
}
//getchar();

}

//詢問是否刪除考生數據
int
judge_delete_val()
{
int n = 2;

do
{
printf("是否要刪除某個考生數據?是請輸入「1」,不是輸入「0」:");
scanf("%d",&n);
getchar();
}
while( n != 0 && n != 1);
return n;
}

//查找第一個姓名為xx的元素並返回其直接前驅的位置
position
find_previous( List L )
{
position q = L;
position p = L->next;
char name[10];
printf("請輸入你要查找的考生姓名:");
gets(name);
while( p != NULL && 0 != strcmp( p->data.name , name))
{
q=p;
p=p->next;
}
if( p != NULL )
{
return q;
}
else
return p;
}

//刪除指定考生信息並輸出其信息
int
delete_val(List L)
{
int n=2;
position q=NULL;
position p=find_previous( L ); //返回考生信息地址
if( NULL == p )
{
printf("你要刪除的考生不存在 ");
return 0;
}
else
{
q = p->next;
p->next = q->next;
printf("刪除成功。 刪除的考生信息為: ");
printf("准考證號:%s 姓名:%s 性別:%s 年齡:%hd 報考科目:%s ",q->data.examno,q->data.name,q->data.sex,q->data.age,q->data.examtype);
free(q);
return 1;
}

}

//輸出該地址考試信息
int
put_pos_information( position p )
{
if(p != NULL )
{
printf("准考證號:%s 姓名:%s 性別:%s 年齡:%hd 報考科目:%s ",p->data.examno,p->data.name,p->data.sex,p->data.age,p->data.examtype);
return 1;
}
else
{
printf("沒有您要查找的學生。");
return 0;
}
}
//菜單函數
void
menu(List L)
{
printf(" a. 考生報名入口 ");
printf(" b. 查詢考生信息 ");
printf(" c. 修改考生信息 ");
printf(" d. 刪除考生信息 ");
printf(" e. 全部考生信息 ");
printf(" f. 程序作者信息 ");
printf(" g. 退出程序 ");
char n='h';

while(n != 'g')
{
do //確定正確輸入
{
printf("請通過字母序號選擇功能:");
n = getchar();
getchar();
putchar(' ');
if( n < 'a' || n > 'g')
{
printf("錯誤的字母序號。 ");
}
}
while( n < 'a' || n > 'g' );
switch (n)
{
case 'a':
{
printf("請輸入報名考生信息: ");
position p = make_node( p, 1 ); //創建新結點
link_to_tail( L, p ); //將新結點連接到表上
put_information( p ); //是否輸出該考生信息
putchar(' ');
}
break;

case 'b':
{
put_name_information( L );
putchar(' ');
}
break;

case 'c':
{
int n=0;
position p = NULL;
printf("您正在進行修改操作。 ");
p = find(L);
n = put_pos_information( p );
if(n)
{
make_node( p , 0 );
put_information( p ); //是否輸出該考生信息
}
putchar(' ');
}
break;

case 'd':
{
printf("您正在進行刪除操作。 ");
delete_val( L );
putchar(' ');
}
break;

case 'e':
{
put_all( L );
putchar(' ');
}
break;

case 'f':
{
printf(" 修改日期 版本號 修改人 修改內容 ");
printf(" -------------------------------------------------------- ");
printf(" 2018.6.19 v2.0 陳百川 增加主菜單 ");
printf(" 2018.6.23 v3.0 陳百川 增加生成文件功能 ");
printf(" 該版本號為v2.0 ");
putchar(' ');
}
break;

default:
break;
}
}
printf(" 感謝本次使用,祝您生活愉快。");
getch();
}

(10)c語言中修改個人信息的代碼擴展閱讀:

C語言是一門通用計算機編程語言,廣泛應用於底層開發。C語言的設計目標是提供一種能以簡易的方式編譯、處理低級存儲器、產生少量的機器碼以及不需要任何運行環境支持便能運行的編程語言。

盡管C語言提供了許多低級處理的功能,但仍然保持著良好跨平台的特性,以一個標准規格寫出的C語言程序可在許多電腦平台上進行編譯,甚至包含一些嵌入式處理器(單片機或稱MCU)以及超級電腦等作業平台。

二十世紀八十年代,為了避免各開發廠商用的C語言語法產生差異,由美國國家標准局為C語言制定了一套完整的美國國家標准語法,稱為ANSI C,作為C語言最初的標准。[1]目前2011年12月8日,國際標准化組織(ISO)和國際電工委員會(IEC)發布的C11標準是C語言的第三個官方標准,也是C語言的最新標准,該標准更好的支持了漢字函數名和漢字標識符,一定程度上實現了漢字編程。

C語言是一門面向過程的計算機編程語言,與C++,Java等面向對象的編程語言有所不同。

其編譯器主要有Clang、GCC、WIN-TC、SUBLIME、MSVC、Turbo C等。

參考資料:

網路——C語言