當前位置:首頁 » 編程語言 » 用c語言編寫河南名片
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

用c語言編寫河南名片

發布時間: 2022-10-01 14:22:36

A. c語言名片管理系統源代碼 怎麼在裡面添加圖片啊

C語言本身不提供該功能,不過可以用系統提供的API函數加入圖片

B. 急!c語言學生名片管理系統

給你一段基本的代碼,你可以在這個基礎上修改

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct person {char name[30]; /* full name */
unsigned birthday, /* 1..31 */
birthmonth, /* 1..12 */
birthyear; /* 4 digits */
};

int main(void)
{
struct person *personlist;
unsigned number_of_persons, num;
char buffer[30];
char *p;
int year, month, day;
int ok;

do
{
printf("Enter the number of persons: ");
fflush(stdout);
if (fgets(buffer, sizeof buffer, stdin) != NULL
&& sscanf(buffer, "%u", &number_of_persons) == 1)
{
ok = 1;
if (number_of_persons>0)
{
personlist = malloc(number_of_persons * sizeof(struct person));
if (personlist==NULL)
{
printf("Not enough memory to store that many persons!\n");
ok = 0;
}
}
}
else
{
ok = 0;
printf("Invalid number! Enter again...\n");
}
}
while (!ok);

if (number_of_persons==0)
{
printf("OK, perhaps another time!\n");
return 0;
}

for (num=0; num<number_of_persons; num++)
{
printf("\nEnter the information for person #%u:\n", num);
printf("Name: ");
fflush(stdout);
if (fgets(buffer, sizeof buffer, stdin) == NULL)
{
printf("Error reading from stdin; input aborted\n");
number_of_persons = num;
break;
}
p = strchr(buffer,'\n');
if (p!=NULL)
*p = '\0';
if (strlen(buffer)==0)
{
printf("Input stopped\n");
number_of_persons = num;
break;
}
strcpy(personlist[num].name, buffer);
do
{
printf("Birthday [YYYY-MM-DD]: ");
fflush(stdout);
if (fgets(buffer, sizeof buffer, stdin) != NULL
&& sscanf(buffer, "%d-%d-%d", &year, &month, &day) == 3
&& year>=1000 && year<=9999
&& month>=1 && month<=12
&& day>=1 && day<=31)
{
ok = 1;
}
else
{
ok = 0;
printf("Invalid birthday! Enter again...\n");
}
}
while (!ok);
personlist[num].birthyear = year;
personlist[num].birthmonth = month;
personlist[num].birthday = day;
}

printf("\nOK, thank you.\n");

printf("\nYou entered the following data:\n");

printf("\n%-10s%-30s%s\n", "Number", "Name", "Birthday");

for (num=0; num<number_of_persons; num++)
{
printf("%-10u%-30s%04d-%02d-%02d\n",
num,
personlist[num].name,
personlist[num].birthyear,
personlist[num].birthmonth,
personlist[num].birthday);
}

free(personlist);

return 0;
}

C. c語言程序設計

我正好做了一個....告訴我郵箱 我發給你

#include "stdio.h"
#include "stdlib.h"
#include "malloc.h"
#include "string.h"
#include <process.h>

/*定義一個結構體*/
typedef struct tongxue{
char name[80];
char number[80];
struct tongxue *next;
}node;

/*主函數*/
int main()
{
/*函數申明*/
node *ru(FILE *fp);
void chaxun(node *p);
node *charu(node *p);
node *genggai(node *p);
node *shanchu(node *p);
void dayin(FILE *fp,node *p);
void freeall(node *p);
int count(node *p);
void print(node *p);

char flag[10];
node *head,*p;
FILE *fp;

/*打開一個文件*/
if((fp=fopen("savefile.txt","r+"))==NULL)
{
printf("打開文件錯誤");
exit(0);
}
/*導入文件*/
head=ru(fp);
do
{
printf("\n");
printf("* * * * * * * * * * * * * * 高三一班號碼管家 V2.0 * * * * * * * * * * * * * *\n");
printf("* 請選擇操作項: *\n");
printf("* 1. 打 印 名 片 *\n");
printf("* 2. 查 詢 名 片 *\n");
printf("* 3. 插 入 名 片 *\n");
printf("* 4. 更 改 名 片 *\n");
printf("* 5. 刪 除 名 片 *\n");
printf("* 6. 退 出 *\n");
printf("* *\n");
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
printf("* 名片總數: %d *\n",count(head));
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
printf(" 輸入: ");
scanf("%s",flag);
p=head;
if(strcmp(flag,"1")==0) print(p); else
if(strcmp(flag,"2")==0) chaxun(p); else
if(strcmp(flag,"3")==0) head=charu(p); else
if(strcmp(flag,"4")==0) head=genggai(p); else
if(strcmp(flag,"5")==0) head=shanchu(p); else
if(strcmp(flag,"6")==0)
{
printf(" ~~~~~~~~~~~~~~~~~~~~ 謝謝使用本軟體,期待您提出寶貴的建議 ~~~~~~~~~~~~~~~~~~~~\n\n\n");
printf(" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 版權歸 y.jie 所有 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n\n");
gets(flag);
break;
}
else
printf(" 輸入有誤,請重新輸入。\n\n");
}
while(1);
dayin(fp,head);
freeall(head);
fclose(fp);
gets(flag);
return 0;
}

/*導入原有名片*/
node *ru(FILE *fp)
{
node *head;
node *p_d,*p_end;
head =(node *)malloc(sizeof(node));
p_d =(node *)malloc(sizeof(node));
p_end=(node *)malloc(sizeof(node));
/*輸入開始項*/
fscanf(fp, "%s", head->name);
fscanf(fp, "%s", head->number);
// printf("%s %s",head->name,head->number);
head->next=p_d;
do
{
if(fscanf(fp, "%s",p_d->name)==EOF) {p_end->next=NULL;free(p_d);break;}
if(fscanf(fp, "%s",p_d->number)==EOF)
{
printf("\n\n\n\n\n 導入失敗\n");
printf(" 請保證 通訊錄.txt 與此文件在統一文件夾。\n\n");
getchar();
exit(0);
}
//printf("%s %s",p_d->name,p_d->number);
p_end=p_d;
p_d=p_d->next=(node *)malloc(sizeof(node));
}
while(1);
return head;
}

/*查詢函數*/
void chaxun(node *p)
{
node *head;
char flag;
char name_1[10];
/*head=(node *)malloc(sizeof(node));*/
head=p;
printf("\n ①查詢名片\n\n");
lab_1:
p=head;
printf("請輸入要查詢同學的姓名: ");
scanf("%s",name_1);
do
{
if(strcmp(name_1,p->name)==0)
{
printf("\n\n %s\n %s\n",p->name,p->number);
printf("\n\n 請繼續選擇操作\n\n");
return;
}
p=p->next;
if(p==NULL)
{printf("\n\n\n\n 抱歉 ! 無該名同學的有關信息\n");
do
{
printf("\n 繼續輸入?(y or n): ");
scanf(" ");
scanf("%c",&flag);
if(flag=='y'||flag=='Y')
goto lab_1;
else
if(flag=='n'||flag=='N')
{printf("\n\n 請繼續選擇操作\n\n");return;}
else
printf("\n\n 輸入有誤,請重新輸入。\n\n");
}
while(1);
}
}
while(1);
}

/*插入函數*/
node *charu(node *p)
{
char flag;
node *head,*p_cha;
head =(node *)malloc(sizeof(node));
p_cha=(node *)malloc(sizeof(node));
head=p;
printf("\n ②插入名片\n\n");
do
{
p=p->next;
if(p->next==NULL) break;
}
while(1);
printf("請輸入姓名: ");
scanf("%s",p_cha->name);
printf("請輸入電話號碼: ");
scanf("%s",p_cha->number);
do
{
printf("\n 確認?(y or n): ");
scanf(" ");
scanf("%c",&flag);
if(flag=='y'||flag=='Y')
{
p_cha->next=NULL;
p->next=p_cha;
printf("\n\n 插入成功。\n\n");
printf("\n\n 請繼續選擇操作\n\n");
return head;
}
else
if(flag=='n'||flag=='N')
{
free(p_cha);
printf("\n\n 成功取消。\n\n");
printf("\n\n 請繼續選擇操作\n\n");
return head;
}
else
printf("\n\n 輸入有誤,請重新輸入。\n\n");
}
while(1);
}

/*更改函數*/
node *genggai(node *p)
{
char flag;
node *head;
char name_2[80];
char number_2[80];
printf("\n ③更改名片\n\n");
head=p;
lab_1: printf("\n請輸入要更改的同學姓名: ");
scanf("%s",name_2);
do
{
if(strcmp(name_2,p->name)==0)
{
printf("\n請輸入新號碼:\n");
scanf("%s",number_2);
do
{
printf("\n 確認?(y or n): ");
scanf(" ");
scanf("%c",&flag);
if(flag=='y'||flag=='Y')
{
strcpy(p->number,number_2);
printf("\n\n 更改成功。\n\n");
printf("\n\n 請繼續選擇操作\n\n");
return head;
}
else
if(flag=='n'||flag=='N')
{
printf("\n\n 成功取消。\n\n");
printf("\n\n 請繼續選擇操作\n\n");
return head;
}
else
printf("\n\n 輸入有誤,請重新輸入。\n\n");
}
while(1);
}
else
p=p->next;
if(p==NULL)
{
printf("\n\n未找到與「 %s 」相匹配的姓名\n\n ",name_2);
lab_2:printf("\n 重新輸入姓名?(y or n): ");
scanf(" ");
scanf("%c",&flag);
if(flag=='y'||flag=='Y')
goto lab_1;
else
if(flag=='n'||flag=='N')
{
printf("\n\n 成功取消。\n");
printf("\n\n 請繼續選擇操作\n");
return head;
}
else
{
printf("\n\n 輸入有誤,請重新輸入。\n\n");
goto lab_2;
}
}
}
while(1);
}

/*刪除的函數*/
node *shanchu(node *head)
{
node *p1,*p2;
char name_1[20];
char flag;
do
{
printf("\n請輸入要刪除的姓名: ");
scanf("%s",name_1);
if(strcmp(head->name,name_1)==0)
{
p1=head;
head=head->next;
free(p1);
printf("\n\n 刪除成功!\n");
printf("\n 請繼續選擇操作\n");
return head;
}
else
{
p1=p2=head;
do
{
p2=p1;
p1=p1->next;
if(strcmp(p1->name,name_1)==0)
{
if(p1->next==NULL)
{
p2->next=NULL;
free(p1);
printf("\n\n 刪除成功!\n");
printf("\n 請繼續選擇操作\n");
return head;
}
else
{
p2->next=p1->next;
free(p1);
printf("\n\n 刪除成功!\n");
printf("\n 請繼續選擇操作\n");
return head;
}
}
}
while(p1->next!=NULL);
}
printf("\n\n 未發現與「 %s 」相匹配的信息\n");
lab_1:
printf("\n 重新輸入?(y or n)\n");
scanf("%c",&flag);
if(flag=='n'||flag=='N')
return head;
else
if(flag!='y'||flag!='Y')
goto lab_1;
}
while(1);
}

/*列印通訊錄*/
void dayin(FILE *fp_1,node *p)
{
if((fp_1=fopen("savefile.txt","w+"))==NULL)
{
printf("打開文件錯誤");
getchar();
exit(0);
}
do
{
fprintf(fp_1,"%s %s\n",p->name,p->number);
}
while((p=p->next)!=NULL);
return ;
}

/*釋放內存空間*/
void freeall(node *p)
{
node *p_1,*p_2;
p_1=p;
p_2=p_1->next;
do
{
free(p_1);
p_1=p_2;
p_2=p_2->next;
}
while(p_2!=NULL);
}

/*統計總數*/
int count(node *p)
{
if(p->next==NULL) return 1;
else
return count(p->next)+1;
}

/*列印名片*/
void print(node *p)
{
printf("\n");
if(p==NULL) return ;
else
{
printf(" %-10s %-20s\n",p->name,p->number);
print(p->next);
}
}

D. 用c語言製作名片格式

struct name_card{;char name[32];char tel[32];char home[32];},裡面的內容需要自己填入。
C語言是一種通用的、面向過程式的計算機程序設計語言。1972 年,為了移植與開發 UNIX 操作系統,丹尼斯·里奇在貝爾電話實驗室設計開發了 C 語言。C語言是一種廣泛使用的計算機語言,它與 Java 編程語言一樣普及,二者在現代軟體程序員之間都得到廣泛使用。

E. C語言名片的製作

10分==1行。
如果100分的話,我相信有人會為你做個批發處理的~~

其實很容易了,做個結構,這個你自己定義
struct name_card{
char name[32];
char tel[32];
char home[32];
};
裡面內容自己寫自己要用的。然後就是結構填寫和處理了。填寫就是你怎麼輸入,處理就是寫到文件里……自己動動手吧。

F. C語言名片管理系統

你是哪個大學的啊?
這么急啊?
不瞞你說我也在做這個題目,已經做得差不多了!這是一個課程設計題目,但是現在答案還不敢公布,畢竟人家是原創的嘛!

G. 用c語言編程以*做一個矩形邊框的個人名片 裡面含有(姓名,性別,職業....)用for的那種

#include<stdio.h>
#include<windows.h>
main()
{
inti;
chara[7][50]={"*****************************",
"*瘋狂小鳥*",
"*初級*",
"*18888888888*",
"*675032915*",
"*銀河系街地球小區1棟1單元101*",
"*****************************"};
for(i=0;i<7;i++){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),9+i);
printf("%s ",a[i]);
}
}

如圖所示,望採納。。。。。。

H. 急!C語言共用體實現設計個人名片,包含姓名,職業,電話

union personal_card
{
char name[15];
char prafession[10];

long int tel;

};

union是聲明其為共用體,name,professin,tel分別代表姓名,職業,電話。

I. c語言共用體實現設計個人名片,包含姓名,職業,電話

//共用體實例你看看行不
#include<stdio.h>
#include<windows.h>
#include<string.h>

//共用體
unionbusinessCard
{
charname[20];//存儲姓名
charjob[20];//存儲職業
charphoneNum[13];//存儲電話號碼
};

voidmain(void)
{
businessCardcard;
FILE*fp;
if(!(fp=fopen("businessCard.txt","a+")))
{
printf("文件打開失敗 ");
exit(0);
}
else
{
printf(">輸入姓名:");
scanf("%s",card.name);
fprintf(fp,"%s ",card.name);
printf(">輸入職業:");
scanf("%s",card.job);
fprintf(fp,"%s ",card.job);
printf(">輸入電話:");
scanf("%s",card.phoneNum);
fprintf(fp,"%s ",card.phoneNum);
}
fclose(fp);

//從已存儲文件中讀取名片
if(!(fp=fopen("businessCard.txt","r")))
{
printf("文件打開失敗…… ");
exit(0);
}
inti,j;
i=1,j=1;
charbuf[20]="";
while(!feof(fp))
{
if(i==1||i-j*3==1)
{
fgets(card.name,20,fp);
if(strcmp(card.name,buf)!=0)
printf(">姓名:%s",card.name);
}

if(i==2||i-j*3==2)
{
fgets(card.job,20,fp);
printf(">職業:%s",card.job);
}

if(i==3||i-j*3==3)
{
fgets(card.phoneNum,20,fp);
printf(">電話:%s ",card.phoneNum);
strcpy(buf,card.phoneNum);
j++;
}
i++;
}
fclose(fp);
}

J. C語言名片的製作

10分==1行。
如果100分的話,我相信有人會為你做個批發處理的~~
其實很容易了,做個結構,這個你自己定義
struct
name_card{
char
name[32];
char
tel[32];
char
home[32];
};
裡面內容自己寫自己要用的。然後就是結構填寫和處理了。填寫就是你怎麼輸入,處理就是寫到文件里……自己動動手吧。