C++で実現した簡単な物流情報ストレージ

3215 ワード

  :c++         、  、  


// wuliu.cpp : by lip
//

#include "stdafx.h"
#include
#include
#include 
#include 
#include 
#include 




struct Product {
	char name[20];
	int id; 
	struct Product *next;
};

struct Product *Head;

struct Product *add(struct Product *h);
void show();
void save(struct Product *h);
void del();
void choice();
void main_init();

struct Product *add(struct Product *h){
	system("cls");
	int n=0;
	int i=0;
	h = NULL;
	struct Product *p;
	printf("
"); printf(" :"); scanf("%d",&n); for (i=0;iname); printf(" :"); scanf("%d",&p->id); printf(" --------------
"); p-> next = NULL; if(h==NULL) h=p; else { struct Product *q=h; while(q->next!=NULL) q=q->next; q->next=p; } } return(h); } void main_init(){ printf("---- ----- ---- ----
"); printf("* 1. 2. 3. *
"); printf("---- ---- ---- ----
"); struct Product *p; p=(struct Product *)malloc(sizeof(struct Product)); int choice; printf(" :"); scanf("%d",&choice); switch(choice){ case 1: p = add(p); save(p); break; case 2: show();break; case 3: del();break; default: exit(1);break; } } void show(){ system("cls"); printf(" , ...
"); struct Product *p; p=(struct Product *)malloc(sizeof(struct Product)); struct Product *q; q=(struct Product *)malloc(sizeof(struct Product)); ifstream read("wuliu.txt",ios::in); if(!read) { cout<>p->name>>p->id; if(read.fail()){ break; } cout<name<id<next=NULL; read.close(); printf("
"); printf(" !
"); choice(); } void del(){ system("cls"); struct Product *p; p=(struct Product *)malloc(sizeof(struct Product)); struct Product *q; q=(struct Product *)malloc(sizeof(struct Product));// ifstream read("wuliu.txt",ios::in);// if(!read) { cout<>q->name; while(read.good()&&!read.eof()) { read>>p->name>>p->id; if(read.fail()){// break; } if( strcmp(p->name,q->name)!=0 ){ save<name<id<name,q->name)==0 ){ save<name<id<name<id<name<id<next; } save.close(); printf(" ...
"); choice(); } void choice(){ int choice; cout<