meilleure orga des fichiers et class contact app ok
This commit is contained in:
@@ -1,53 +1,39 @@
|
||||
#include "Contact.class.hpp"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
Contact::Contact( void ) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Contact::~Contact( void ) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void Contact::add_index( std::string str ) {
|
||||
|
||||
this->index.assign(str);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void Contact::add_first( std::string str ) {
|
||||
|
||||
this->first.assign(str);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void Contact::add_last( std::string str ) {
|
||||
|
||||
this->last.assign(str);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void Contact::add_nick( std::string str ) {
|
||||
|
||||
this->nick.assign(str);
|
||||
return;
|
||||
|
||||
}
|
||||
void Contact::add_num( std::string str ) {
|
||||
this->num.assign(str);
|
||||
return;
|
||||
}
|
||||
void Contact::add_secret( std::string str ) {
|
||||
this->secret.assign(str);
|
||||
return;
|
||||
}
|
||||
|
||||
void Contact::print_contact( void ) {
|
||||
|
||||
std::cout << "INDEX : " << this->index << std::endl;
|
||||
std::cout << "FIRST NAME : " << this->first << std::endl;
|
||||
std::cout << "LAST NAME : " << this->last << std::endl;
|
||||
std::cout << "NICKNAME : " << this->nick << std::endl;
|
||||
std::cout << "NUMBER : " << this->num << std::endl;
|
||||
std::cout << "SECRET : " << this->secret << std::endl;
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,22 +1,40 @@
|
||||
#ifndef CONTACT_CLASS_HPP
|
||||
# define CONTACT_CLASS_HPP
|
||||
|
||||
#include <string>
|
||||
# include <iostream>
|
||||
# include <string>
|
||||
|
||||
class Contact {
|
||||
public:
|
||||
Contact();
|
||||
~Contact();
|
||||
std::string index;
|
||||
std::string first;
|
||||
std::string last;
|
||||
std::string nick;
|
||||
void add_index(std::string str);
|
||||
void add_first(std::string str);
|
||||
void add_last (std::string str);
|
||||
void add_nick (std::string str);
|
||||
void print_contact();
|
||||
|
||||
public:
|
||||
|
||||
Contact();
|
||||
~Contact();
|
||||
|
||||
void add_first(std::string str);
|
||||
void add_last (std::string str);
|
||||
void add_nick (std::string str);
|
||||
void add_num(std::string str);
|
||||
void add_secret(std::string str);
|
||||
|
||||
void print_contact();
|
||||
|
||||
private:
|
||||
|
||||
std::string first;
|
||||
std::string last;
|
||||
std::string nick;
|
||||
std::string num;
|
||||
std::string secret;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* create_contact (first ; last ; nick ; num ; secret)
|
||||
* get_first
|
||||
* get_last
|
||||
* get_nick
|
||||
* print_contact
|
||||
*/
|
||||
|
||||
@@ -15,12 +15,14 @@ LIBS =
|
||||
|
||||
INCLUDES = -I$(D_HEADERS)
|
||||
|
||||
D_HEADERS = .
|
||||
HEADERS = PhoneBook.class.hpp \
|
||||
PhoneBook.class.cpp
|
||||
|
||||
D_SRCS = .
|
||||
SRCS = main.cpp \
|
||||
Contact.class.cpp \
|
||||
PhoneBook.class.cpp
|
||||
|
||||
D_HEADERS = .
|
||||
HEADERS = Contact.class.hpp \
|
||||
PhoneBook.class.hpp
|
||||
|
||||
D_OBJS = builds
|
||||
OBJS = $(SRCS:%.cpp=$(D_OBJS)/%.o)
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
//#include <string>
|
||||
//#include <iomanip>
|
||||
#include <cstring>
|
||||
#include "PhoneBook.class.hpp"
|
||||
|
||||
PhoneBook::PhoneBook( void ) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef PHONEBOOK_CLASS_HPP
|
||||
# define PHONEBOOK_CLASS_HPP
|
||||
#include "Contact.class.cpp"
|
||||
|
||||
#include "Contact.class.hpp"
|
||||
#include <cstring>
|
||||
|
||||
class PhoneBook {
|
||||
public:
|
||||
|
||||
BIN
d00/ex01/builds/Contact.class.o
Normal file
BIN
d00/ex01/builds/Contact.class.o
Normal file
Binary file not shown.
BIN
d00/ex01/builds/PhoneBook.class.o
Normal file
BIN
d00/ex01/builds/PhoneBook.class.o
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,10 +1,34 @@
|
||||
#include "PhoneBook.class.cpp"
|
||||
#include <iostream>
|
||||
#include "PhoneBook.class.hpp"
|
||||
#include "Contact.class.hpp"
|
||||
|
||||
# include <iostream>
|
||||
# include <string>
|
||||
|
||||
int main() {
|
||||
|
||||
PhoneBook yellow;
|
||||
yellow.contact.add_first("hugo");
|
||||
yellow.contact.print_contact();
|
||||
Contact new_contact;
|
||||
new_contact.add_first("hugo");
|
||||
new_contact.add_last("lamy");
|
||||
new_contact.add_nick("hugonosaure");
|
||||
new_contact.add_num("0123456789");
|
||||
new_contact.add_secret("je suis un dino");
|
||||
new_contact.print_contact();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* class PhoneBook :
|
||||
* add_contact (->Contact.create_contact)
|
||||
* search_contact
|
||||
* print_phonebook (->Contact.get_index/name/last/nick)
|
||||
* index_print (Contact.print_contact)
|
||||
* exit
|
||||
*
|
||||
* class Contact :
|
||||
* create_contact (first ; last ; nick ; num ; secret)
|
||||
* get_first
|
||||
* get_last
|
||||
* get_nick
|
||||
* print_contact
|
||||
*
|
||||
*/
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user