博文

成绩系统(2005-08-07 10:37:00)

摘要:#include <iostream.h>
#include <string.h>
#include <fstream.h>

struct student
{
char num[10];
char name[20];
int  age;
int  score;
struct student *next;
};
class grade
{
private :
    struct student * head,* last;    
public :
    void init();
    void insert();
    int delete();
    int select();
    int modify();
    int display();
    int total();
    void savefile();
    void quit();
};

void grade::init()
{
printf("************************************主菜单************************************\n");
printf("\t1输入学生资料\t\t\t\t\t2删除学生资料\n");
printf("\t3查询学生资料\t\t\t\t\t4修改学生资料\n"......

阅读全文(3333) | 评论:0 | 复制链接

聊天(C++)(2005-08-07 10:33:00)

摘要:1  局域网聊天的程序(C++版)  
  //server
#include <winsock.h>
#include <iostream.h>
#include <stdio.h>
#include <string.h>
#include <windows.h>
#define PORT 100
#define socklen_t int
#pragma comment(lib, "wsock32.lib")
SOCKET s;
SOCKET client;
sockaddr_in from;
void ServerThread()
{
char message[256];
while(1)
{
strcpy(message,"");
int len=recv(client,message,sizeof(message),0);
if (strcmp(message,"")!=0)
{
cout<<"从"<<inet_ntoa(from.sin_addr)<<"得到消息:\n";
//cout<<"len:"<<len<<endl;
message[len]='\0';
cout<<message;
}
}
}
int main()
{
sockaddr_in srv;
int fromlen=sizeof(from);
char message[256]="Welcome!\n";
WSADATA wsadata;
WORD VersionRequested=MAKEWORD(1,1);
if (WSAStartup(VersionRequ......

阅读全文(4776) | 评论:1 | 复制链接