phonebook class contact fonction print fonctionne
This commit is contained in:
45
README.md
45
README.md
@@ -1,45 +1,2 @@
|
|||||||
**Edit a file, create a new file, and clone from Bitbucket in under 2 minutes**
|
gdp tuto : https://u.osu.edu/cstutorials/2018/09/28/how-to-debug-c-program-using-gdb-in-6-simple-steps/
|
||||||
|
|
||||||
When you're done, you can delete the content in this README and update the file with details for others getting started with your repository.
|
|
||||||
|
|
||||||
*We recommend that you open this README in another tab as you perform the tasks below. You can [watch our video](https://youtu.be/0ocf7u76WSo) for a full demo of all the steps in this tutorial. Open the video in a new tab to avoid leaving Bitbucket.*
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Edit a file
|
|
||||||
|
|
||||||
You’ll start by editing this README file to learn how to edit a file in Bitbucket.
|
|
||||||
|
|
||||||
1. Click **Source** on the left side.
|
|
||||||
2. Click the README.md link from the list of files.
|
|
||||||
3. Click the **Edit** button.
|
|
||||||
4. Delete the following text: *Delete this line to make a change to the README from Bitbucket.*
|
|
||||||
5. After making your change, click **Commit** and then **Commit** again in the dialog. The commit page will open and you’ll see the change you just made.
|
|
||||||
6. Go back to the **Source** page.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Create a file
|
|
||||||
|
|
||||||
Next, you’ll add a new file to this repository.
|
|
||||||
|
|
||||||
1. Click the **New file** button at the top of the **Source** page.
|
|
||||||
2. Give the file a filename of **contributors.txt**.
|
|
||||||
3. Enter your name in the empty file space.
|
|
||||||
4. Click **Commit** and then **Commit** again in the dialog.
|
|
||||||
5. Go back to the **Source** page.
|
|
||||||
|
|
||||||
Before you move on, go ahead and explore the repository. You've already seen the **Source** page, but check out the **Commits**, **Branches**, and **Settings** pages.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Clone a repository
|
|
||||||
|
|
||||||
Use these steps to clone from SourceTree, our client for using the repository command-line free. Cloning allows you to work on your files locally. If you don't yet have SourceTree, [download and install first](https://www.sourcetreeapp.com/). If you prefer to clone from the command line, see [Clone a repository](https://confluence.atlassian.com/x/4whODQ).
|
|
||||||
|
|
||||||
1. You’ll see the clone button under the **Source** heading. Click that button.
|
|
||||||
2. Now click **Check out in SourceTree**. You may need to create a SourceTree account or log in.
|
|
||||||
3. When you see the **Clone New** dialog in SourceTree, update the destination path and name if you’d like to and then click **Clone**.
|
|
||||||
4. Open the directory you just created to see your repository’s files.
|
|
||||||
|
|
||||||
Now that you're more familiar with your Bitbucket repository, go ahead and add a new file locally. You can [push your change back to Bitbucket with SourceTree](https://confluence.atlassian.com/x/iqyBMg), or you can [add, commit,](https://confluence.atlassian.com/x/8QhODQ) and [push from the command line](https://confluence.atlassian.com/x/NQ0zDQ).
|
|
||||||
53
d00/ex01/Contact.class.cpp
Normal file
53
d00/ex01/Contact.class.cpp
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#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::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;
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
22
d00/ex01/Contact.class.hpp
Normal file
22
d00/ex01/Contact.class.hpp
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#ifndef CONTACT_CLASS_HPP
|
||||||
|
# define CONTACT_CLASS_HPP
|
||||||
|
|
||||||
|
#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();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -16,11 +16,11 @@ LIBS =
|
|||||||
INCLUDES = -I$(D_HEADERS)
|
INCLUDES = -I$(D_HEADERS)
|
||||||
|
|
||||||
D_HEADERS = .
|
D_HEADERS = .
|
||||||
HEADERS = Phonebook.class.hpp \
|
HEADERS = PhoneBook.class.hpp \
|
||||||
Phonebook.class.cpp
|
PhoneBook.class.cpp
|
||||||
|
|
||||||
D_SRCS = .
|
D_SRCS = .
|
||||||
SRCS = Phonebook.cpp \
|
SRCS = main.cpp \
|
||||||
|
|
||||||
D_OBJS = builds
|
D_OBJS = builds
|
||||||
OBJS = $(SRCS:%.cpp=$(D_OBJS)/%.o)
|
OBJS = $(SRCS:%.cpp=$(D_OBJS)/%.o)
|
||||||
|
|||||||
16
d00/ex01/PhoneBook.class.cpp
Normal file
16
d00/ex01/PhoneBook.class.cpp
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
//#include <string>
|
||||||
|
//#include <iomanip>
|
||||||
|
#include <cstring>
|
||||||
|
#include "PhoneBook.class.hpp"
|
||||||
|
|
||||||
|
PhoneBook::PhoneBook( void ) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PhoneBook::~PhoneBook( void ) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
12
d00/ex01/PhoneBook.class.hpp
Normal file
12
d00/ex01/PhoneBook.class.hpp
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#ifndef PHONEBOOK_CLASS_HPP
|
||||||
|
# define PHONEBOOK_CLASS_HPP
|
||||||
|
#include "Contact.class.cpp"
|
||||||
|
|
||||||
|
class PhoneBook {
|
||||||
|
public:
|
||||||
|
PhoneBook();
|
||||||
|
~PhoneBook();
|
||||||
|
Contact contact;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
//#include <string>
|
|
||||||
//#include <iomanip>
|
|
||||||
#include <iostream>
|
|
||||||
#include "Phonebook.class.hpp"
|
|
||||||
|
|
||||||
Phonebook::Phonebook( void ) {
|
|
||||||
|
|
||||||
std::cout << "hello" << std::endl;
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Phonebook::~Phonebook( void ) {
|
|
||||||
|
|
||||||
std::cout << "good bye" << std::endl;
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#ifndef PHONEBOOK_CLASS_HPP
|
|
||||||
# define PHONEBOOK_CLASS_HPP
|
|
||||||
|
|
||||||
class Phonebook {
|
|
||||||
public:
|
|
||||||
Phonebook();
|
|
||||||
~Phonebook();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#include "Phonebook.class.cpp"
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
|
|
||||||
Phonebook yellow;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
BIN
d00/ex01/builds/PhoneBook.o
Normal file
BIN
d00/ex01/builds/PhoneBook.o
Normal file
Binary file not shown.
BIN
d00/ex01/builds/main.o
Normal file
BIN
d00/ex01/builds/main.o
Normal file
Binary file not shown.
10
d00/ex01/main.cpp
Normal file
10
d00/ex01/main.cpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include "PhoneBook.class.cpp"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
|
||||||
|
PhoneBook yellow;
|
||||||
|
yellow.contact.add_first("hugo");
|
||||||
|
yellow.contact.print_contact();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
d00/ex01/phonebook
Executable file
BIN
d00/ex01/phonebook
Executable file
Binary file not shown.
@@ -1,13 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
|
|
||||||
int main(int ac, char **av)
|
|
||||||
{
|
|
||||||
if (ac < 2)
|
|
||||||
std::cout << std::uppercase << "shhhhh... I think the students are asleep...";
|
|
||||||
else
|
|
||||||
for (int i = 1; av[i] != NULL; i++)
|
|
||||||
for (int j = 0; av[i][j] != '\0'; j++)
|
|
||||||
std::cout << (char)toupper(av[i][j]);
|
|
||||||
std::cout << std::endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user