c语言如何自动编号函数 c语言编写一个自动选号程序( 二 )


cout"电话号码"people[i].phoneendl;
cout"邮箱"people[i].mailendl;
}
if(you==0)
cout"没有通过姓名找到联系人"endl;
}
if(ok==1)
{
//cout"通过电话找联系人"endl;
//system("pause");
bool you=0;
for(i=0;in;i++)
if(strcmp(s,people[i].phone)==0)
{
you=1;
cout"姓名"people[i].nameendl;
cout"电话号码"people[i].phoneendl;
cout"邮箱"people[i].mailendl;
}
if(you==0)
cout"没有通过电话找到联系人"endl;
}
}
if(k==2)
{
p1=fopen("list.txt","a+");
char ss[1000];
cout"请输入姓名"endl;
cinss;
fprintf(p1,"%s\n",ss);
cout"请输入电话"endl;
cinss;
fprintf(p1,"%s\n",ss);
cout"请输入邮箱"endl;
cinss;
fprintf(p1,"%s\n",ss);
fclose(p1);
}
}
return 0;
}
C语言中字符串怎样转换为asc编号字符串要转为ascii码值c语言如何自动编号函数,需要逐个字符转换为ASCII码 。
在C语言中c语言如何自动编号函数 , 要输出字符的ASCII码值,只需要用%d的格式,用printf函数输出即可 。因为%d的格式下 , 会将字符型变量转为整型,值就是ASCII码值 。
编写函数如下:
void print_asc(const char *s)
{
while(*s) printf("%d ",*s++);
}
在C语言中如何指定字符串编码方式计算机用两个字节来表示一个汉字c语言如何自动编号函数,“我”在内存里就是这样存放c语言如何自动编号函数的:CE D2 。CE是str[0]的内容c语言如何自动编号函数 , D2是str[1]的内容 。第一次循环输出str[0],但是这个字符在ASCII字符集里代表这样一个东西?(不知道在这儿能不能正常显示……),但是Windows的命令提示符程序读取到这里就会自动使用宽字符集,也就是说,它已经准备好读取下一个字符 , 然后把他们当成一个字符显示出来 。于是就出现c语言如何自动编号函数了那个汉字 。#include stdio.h int main() { printf("%c%c",(char)0xce,(char)0xd2); }
c语言编写一个通讯录系统 用简单一点的c??#define N 100
#define SIZE 30
#include stdio.h
#include string.h
#include conio.h
struct student{
char num[SIZE];
char name[SIZE];
char tel[SIZE];
};
/*函数声明*/
void myprint();/*显示菜单*/
int mycreat(struct student*p,int n);/*输入通讯录*/void mydisplay(struct student*p,int n);/*显示通讯录*/void mysearch(struct student*p,int n);/*查找*/
void mymodify(struct student*p,int n);/*修改通讯录*/int myadd(struct student*p,int n);/*增加通讯录*/int mydelete(struct student*p,int n);/*删除*/void mysort(struct student*p,int n);/*排序*/
void sch_num(struct student*p,int n);/*按学号查找*/void sch_name(struct student*p,int n);/*按姓名查找*/
int loadinfo(struct student*p,int n);/*载入通讯录信息*/int saveinfo(struct student*p,int n);/*保存通讯录信息*/void main(){
/*文件定义*/char choose,yes_no;
struct studentrecord[N];/*存放通讯录信息,共100条*/int total=0,flag;/*通讯录总数*/
total=loadinfo(record,N);/*从文件读取记录信息,不超过100条*/do{
myprint();/*显示菜单*/
printf("请选择:");do{
choose=getchar();}
while(choose'0'||choose'9');switch(choose){
case'1':
total=mycreat(record,total);break;case'2':
mydisplay(record,total);break;case'3':
mysearch(record,total);break;case'4':
mymodify(record,total);break;case'5':
total=myadd(record,total);break;case'6':
total=mydelete(record,total);break;case'7':
mysort(record,total);break;case'8':
flag=saveinfo(record,total);if(flag==1)
printf("\n保存成功!\n");else
printf("\n保存失败!\n");break;case'0':

推荐阅读