ÄÚµå Áú¹®Á» µå¸±°Ô¿ä ¤Ì [4]

¡ã ¸Ç¹Ø ¡å
´Ï²¨µþ²¨ÀÓ
¾Æ¹ÙŸ/ÂÊÁö/±Û°Ë»ö

2018-04-19 19:19:05
0 0 4 271

¨Û Ãßõ  ¨á ´ÜÃàURL
¡è º¹»ç ÈÄ ºÙ¿©³ÖÀ¸¼¼¿ä.
 ±â±â¸¦ °¨ÁöÇÏ¿© ÃÖÀû URL ·Î º¸³»ÁÝ´Ï´Ù.
´Ï²¨µþ²¨ÀÓ
https://humoruniv.com/program5919 URL º¹»ç

Çлý°ü¸® ½Ã½ºÅÛ °°Àº°É ¸¸µå´Âµ¥

ÆÄÀÏÀº main, student.cpp, student.h ÀÌ·¸°Ô 3°³ ¾²°íÀÖ°í
Çлý µ¥ÀÌÅÍ Ãß°¡ÇÒ‹š ¸µÅ©µå¸®½ºÆ®ÀÌ¿ëÇØ¼­ ±¸ÇöÇÏ·Á°í Çϴµ¥
main ¹®À» ÅëÇØ¼­ menu ¹øÈ£ ¹Þ¾Æ¼­ switch¹® ¾È¿¡¼­ ÇлýÁ¤º¸Ãß°¡ ÇÏ°í ´Ù½Ã switch¹®¿¡¼­ È®ÀÎ ÄÚµå ·Î ÇØº¸´Ï °ªÀÌ ºñ¿öÁ® ¹ö·Á¿ä...
½ºÀ§Ä¡¹® ¾ÈÀÇ ÇÔ¼ö³»ºÎ¿¡¼­ ¸Þ¸ð¸® ÇÒ´çÀ» ÇØ¼­ ±×·±°É±î¿ä ?>

Main.cpp
#include
#include "Kong_Student.h"

using namespace std;

int main£¨£©
{
List list;
ListInit£¨&list£©;

int menunumber = 0;


while £¨1£©
{
menuout£¨£©; cin >> menunumber; system£¨"cls"£©;
switch £¨menunumber£©
{

case 1:AddStudent£¨&list£©; break;
case 2:break;
case 3:StudentListShow£¨&list£©; break;
case 4: break;
case 5: return 0;
}
}


return 0;
}









"Kong_Student.cpp"
#pragma once
#include "Kong_Student.h"
#include

using namespace std;

Kong_Student::Kong_Student£¨£©
{
//ctor
}

Kong_Student::~Kong_Student£¨£©
{
//dtor
}

void ListInit£¨List *plist£©
{
//plist->head = £¨Kong_Student*£©malloc£¨sizeof£¨Kong_Student£©£©; //´õ¹Ì
plist->head = new Kong_Student£¨£©;
plist->head->next = NULL;
plist->numOfData = 0;

}





//////////////////////////
int comparechar£¨char* str1, char*str2, int num£©
{
for £¨int i = 0; inext = plist->head->next;
plist->head->next = Newstudent;
£¨plist->numOfData£©++;
plist->cur = plist->head->next;

char ok[2];
while £¨!comparechar£¨ok, "Y", 1£©£©
{
int itempsex;
char chtempsex[5];
int tempage;
char tempname[20];
char tempphone[20];

cout << "¼ºº°À» ÀÔ·ÂÇØÁÖ¼¼¿ä.£¨³² : 0 , ¿© : 1£© : "; cin >> itempsex;
cout << "¼ºº°À» ÀÔ·ÂÇØÁÖ¼¼¿ä. : "; cin >> chtempsex;
cout << "³ªÀÌÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä. : "; cin >> tempage;
cout << "ÈÞ´ëÆù ¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.£¨xxx-xxxx-xxxx£© :"; cin >> tempphone;
cout << "À̸§À» ÀÔ·ÂÇØÁÖ¼¼¿ä. : "; cin >> tempname;

cout << endl << "Ãß°¡ Á¤º¸ È®ÀÎ" << endl;
cout << "À̸§\t¼ºº°\t³ªÀÌ\tÈÞ´ëÆù¹øÈ£" << endl;
cout << tempname << "\t"; if £¨itempsex == 0£©cout << "³²\t"; else cout << "¿©\t"; cout << tempage << "\t" << tempphone << "\t" << endl << endl;
cout << "Á¤º¸°¡ ¸Â½À´Ï±î ? [Y/N] ";
cin >> ok;

if £¨comparechar£¨ok, "Y", 1£©£©
{
Newstudent->Setname£¨tempname£©;
Newstudent->Setage£¨tempage£©;
Newstudent->Setisex£¨itempsex£©;
Newstudent->Setchsex£¨chtempsex£©;
Newstudent->Setphone£¨tempphone£©;
}

system£¨"cls"£©;
}

}

void StudentListShow£¨List *plist£©
{
cout << "No\tÀ̸§\t¼ºº°\t³ªÀÌ\tÈÞ´ëÆù¹øÈ£" << endl;
cout << plist->numOfData;
for £¨int i = 0; inumOfData; i++£©
{
char* tempname = plist->cur->Getname£¨£©;
cout<<i+1<<"\t"<<tempname;
}

}
void menuout£¨£©
{
cout << "Çлý°ü¸® ½Ã½ºÅÛ" << endl << "Menu" << endl << endl << "[1] Çлýµî·Ï" << endl << "[2] Çлý»èÁ¦" << endl << "[3] Çлý¸®½ºÆ®" << endl << "[4] Á¤º¸»èÁ¦" << endl << "[5] Á¾·á" << endl << endl << "¸Þ´º¸¦ ¼±ÅÃÇÏ¿© ÁÖ¼¼¿ä : ";
}

















#ifndef KONG_STUDENT_H
#define KONG_STUDENT_H
#pragma once
#include "stdlib.h"


class Kong_Student
{
public:
Kong_Student£¨£©;
~Kong_Student£¨£©;

char* Getname£¨£© { return name; }
void Setname£¨char* val£© { name = val; }
int Getage£¨£© { return age; }
void Setage£¨int val£© { age = val; }
int Getisex£¨£© { return isex; }
void Setisex£¨int val£© { isex = val; }
char* Getchsex£¨£© { return chsex; }
void Setchsex£¨char* val£© { chsex = val; }
char* Getphone£¨£© { return phone; }
void Setphone£¨char* val£© { phone = val; }

Kong_Student* next;
protected:

public:
char* name;
int age;
int isex;
char* chsex;
char* phone;
};

typedef struct _linkedLIst
{
Kong_Student* head;
Kong_Student* cur;
Kong_Student* before;
int numOfData;
}LinkedLIst;

typedef LinkedLIst List;

void ListInit£¨List *plist£©;


int comparechar£¨char* str1, char*str2, int num£©;
void AddStudent£¨List *plist£©;
void StudentListShow£¨List *plist£©;
void menuout£¨£©;

#endif // KONG_STUDENT_H



* ÄÁÅÙÃ÷ Ãâó : ÀÛ¼ºÀÚ º»ÀÎ
Áú¹®¿¡ ´äº¯Çϱâ

¨Û °Ô ½Ã ¹°    Ãß Ãµ ÇÏ ±â
  ·Î±×ÀÎ ¾øÀÌ Ãßõ°¡´ÉÇÕ´Ï´Ù.
ÃßõµÇ¾ú½À´Ï´Ù.
¨Û Ãßõ   ¨ä ¹Ý´ë   ¨Þ ´ä±Û   ¢Ç ¸ñ·Ï
¡ç µÚ·Î   ¡è ¸ÇÀ§   ¡é ¸Ç¹Ø   ¨· ½Å°í   ¢½ ½ºÅ©·¦
¡ç µÚ·Î   ¡è ¸ÇÀ§   ¡é ¸Ç¹Ø   ¨· ½Å°í   ¢½ ½ºÅ©·¦
´ä±Û ÀÛ¼ºÇϱâ (·Î±×ÀÎ ÇÊ¿ä)
·Î±×ÀÎ   ¸ÞÀÎ   »çÀÌÆ®¸Ê   PCÈ­¸é