一个通讯录代码。提供参考,写的既不像c,又不像c++
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <windows.h>
#include <iostream>
using namespace std;
class student{
private:
char name[20],addr[40];
char id_number[40],phone[20];
public:
void searchstud_info();
void addstud_info();
void delstud_info();
void showstud_info();
};
student stud[1000];
static int i = 0;
void main()
{
int choose;
student stu1;
while(1)
{
system("cls");
printf("\t*****************************************************\n");
printf("\t\t1.增加人员信息\n");
printf("\t\t2.显示人员信息\n");
printf("\t\t3.查找人员信息\n");
printf("\t\t4.删除人员信息\n");
printf("\t\t0.退出系统\n");
printf("\t*****************************************************\n");
printf("\t输入您的选择:");
scanf("%d",&choose);
switch(choose)
{
case 1: stu1.addstud_info();break;
case 2: stu1.showstud_info();break;
case 3: stu1.searchstud_info();break;
case 4: stu1.delstud_info();break;
case 0: printf("请按任意键退出....");
exit(0);
}
}
}
void student::addstud_info()
{
printf("请输入人员姓名:");
scanf("%s",stud[i].name);
printf("\n请输入人员身份证号:");
scanf("%s",stud[i].id_number);
printf("\n请输入人员电话号码:");
scanf("%s",stud[i].phone);
printf("\n请输入人员地址:");
scanf("%s",stud[i].addr);
i++;
}
void student::showstud_info()
{
int j;
if(i==0)
printf("\t暂时通讯录中还未有记录!\n");
fo
相关文档:
Boss说,要看OpenGL,看了快一个月,总算出了个像样的东西,用C写了个3D迷宫,
虽然只有350行
代码,不过边学边写,足足写了一周时间,还是小有成就感的,活活活!
&n ......
函数存放在内存的代码区域内,它们同样有地址,我们如何能获得函数的地址呢?
如果我们有一个int test(int a)的函数,那么,它的地址就是函数的名字,这一点如同数组一样,数组的名字就是数组的起始地址。
定义一个指向函数的指针用如下的形式,以上面的test()为例:
int (*fp)(int a);//这里就定义了一个指 ......
上篇文章说到linux需要itoa函数,下面我就提供一份跨平台的itoa函数。
//return the length of result string. support only 10 radix for easy use and better performance
int my_itoa(int val, char* buf)
{
const int radix = 10;
char* p;
int a;&nbs ......
一、什么是C/S和B/S
第一、什么是C/S结构。C/S
(Client/Server)结构,即大家熟知的客户机和服务器结构。它是软件系统体系结构,通过它可以充分利用两端硬件环境的优势,将任务合理分配到
Client端和Server端来实现,降低了系统的通讯开销。目前大多数应用软件系统都是Client/Server形式的两层结构,由于现在的软件应
......