네임스페이스, 클래스, 멤버 함수, stdio 스트림, 초기화 목록, 정적, const 및 많은 기본 항목
Summary: 이 문서는 cpp모듈에 대한 주제가 포함되어있습니다.
Any function implemented in a header (except in the case of templates), and any
unprotected header, means 0 to the exercise.
먼소리야...)
Every output goes to the standard output, and will be ended by a newline, unless
specified otherwise.
The imposed filenames must be followed to the letter, as well as class names, function names and method names.
주어진 파일 이름 뒤에는 클래스 이름, 함수 이름 및 메소드 이름 뿐 아니라 문자가 와야 함
Remember: You are coding in C++ now, not in C anymore.
기억 : 너는 지금부터 c++로 코딩해 더이상 c가 아냐 😎
Therefore:
The following functions are FORBIDDEN, and their use will be punished by
a 0, no questions asked: alloc, printf and free.
You are allowed to use basically everything in the standard library. HOWEVER, it would be smart to try and use the C++-ish versions of the functions
you are used to in C, instead of just keeping to what you know, this is a
new language after all. And NO, you are not allowed to use the STL until
you actually are supposed to (that is, until module 08). That means no vectors/lists/maps/etc... or anything that requires an include until
then
그러므로 :
alloc, printf 그리고 free 사용을 금지한다. 사용하면 0점이다.
기본적으로 표준 라이브러리의 모든 것을 사용할 수 있습니다. 하지만, 새로운 언어인 만큼, c에서 사용했던 비슷한 함수들을 사용하는게 현명하다.그리고 STL함수 사용은 동의 하지 않는다. 정확히 module 08을 진행할때 까지. 이 의미는 벡터/리스트/맵스 등등 algorithm 헤더에 포함된 것들은 모두 불가능.
Actually, the use of any explicitly forbidden function or mechanic will be punished
by a 0, no questions asked
Also note that unless otherwise stated, the C++ keywords "using namespace" and
"friend" are forbidden. Their use will be punished by a -42, no questions asked
Files associated with a class will always be ClassName.hpp and ClassName.cpp,
unless specified otherwise.
Turn-in directories are ex00/, ex01/, . . . , exn/.
You must read the examples thoroughly. They can contain requirements that are
not obvious in the exercise’s description. If something seems ambiguous, you don’t
understand C++ enough.
Since you are allowed to use the C++ tools you learned about since the beginning,
you are not allowed to use any external library. And before you ask, that also means no C++11 and derivates, nor Boost or anything your awesomely skilled friend told
you C++ can’t exist without.
You may be required to turn in an important number of classes. This can seem
tedious, unless you’re able to script your favorite text editor.
Read each exercise FULLY before starting it! Really, do it.
The compiler to use is clang++
Your code has to be compiled with the following flags : -Wall -Wextra -Werror.\
Each of your includes must be able to be included independently from others.
Includes must contains every other includes they are depending on, obviously.
In case you’re wondering, no coding style is enforced during in C++. You can use
any style you like, no restrictions. But remember that a code your peer-evaluator
can’t read is a code she or he can’t grade.
Important stuff now : You will NOT be graded by a program, unless explictly
stated in the subject. Therefore, you are afforded a certain amount of freedom in
how you choose to do the exercises. However, be mindful of the constraints of each
exercise, and DO NOT be lazy, you would miss a LOT of what they have to offer !
19 제출한 파일에 관련없는 파일이 있는것은 문제가 되지 않는다. 요구된거 보다 더 많은 파일에서 코드가 분할되어서 들어가도 됨. 프로그램이 결과를 채점하지 않는한 자유롭게 가능
Even if the subject of an exercise is short, it’s worth spending some time on it to
be absolutely sure you understand what’s expected of you, and that you did it in
the best possible way.
Turn-in directory : ex00/
Files to turn in : Makefile, megaphone.cpp
Forbidden functions : None
Just to be sure that everybody is awake, write a program that has the following
behavior:
$>./megaphone "shhhhh... I think the students are asleep..."
SHHHHH... I THINK THE STUDENTS ARE ASLEEP...
$>./megaphone Damnit " ! " "Sorry students, I thought this thing was off."
DAMNIT ! SORRY STUDENTS, I THOUGHT THIS THING WAS OFF.
$>./megaphone
* LOUD AND UNBEARABLE FEEDBACK NOISE *
$>
Turn-in directory : ex01/
Files to turn in : Makefile, .cpp, .{h, hpp}
Forbidden functions : None
Welcome to the 80s and its unbelievable technology! Write a program that behaves like a crappy awesome phonebook software. Please take some time to give your executable a relevant name. When the program starts, the user is prompted for input: you should accept the ADD command, the SEARCH command or the EXIT command. Any other
input is discarded.
The program starts empty (no contacts), doesn’t use any dynamic allocation, and can’t store more than 8 contacts. If a ninth contact is added, replace the oldest contact
If the command is EXIT:
명령이 EXIT인 경우
◦ The program quits and the contacts are lost forever.
프로그램이 종료됩니다. 그리고 연락처는 영원히 손실됩니다.
Else if the command is ADD:
명령이 ADD인 경우
◦ The program will prompt the user to input a new contact’s information, one field at a time, until every field is accounted for.
프로그램은 연락처의 매 번 한번씩 모든 정보가 채워질 때 까지 연락처의 정보를 받아들임
A contact is defined by the following fields: first name, last name, nickname,
phone number,darkest secret.
연락처는 다음 필드로 정의됩니다. : 이름, 성, 별명, 전화번호, 가장 어두운 비밀
The PhoneBook must be represented as as an instance of a class in your code it must contain an array of contact
전화번호부는 코드에서 클래스의 인스턴스로 표시되어야한다. 연락처배열을 포함해야 합니다.
A contact MUST be represented as an instance of a class in your code. You’re free to design the class as you like but the peer evaluation will check the
consistency of your choices. Go look at today’s videos again if you don’t understand what I mean
연락처는 코드에서 클래스의 인스턴스로 표시되어야 합니다. 니가 원하는대로 class를 디자인할수 있습니다. 그러나 동료 평가는 너의 선택이 일관성있는지 체크한다. 이해가 안된다면 다시 비디오 보고 오세요! (비디오도 있나?)
Else if the command is SEARCH:
명령어가 SEARCH 일때
The program will display a list of the available non-empty contacts in 4
columns: index, first name, last name and nickname.
프로그램은 4가지 항목에서 비어있지않는 사용가능한 연락처목록을 표시합니다.
Each column must be 10 chars wide, right aligned and separated by a ’|’
character. Any output longer than the columns’ width is truncated and the
last displayable character is replaced by a dot
각 열은 10자 여야하고, 오른쪽 정렬되고 문자 '|'로 구분되어야합니다. 열 너비보다 긴 출력은 잘리고, 마지막 표시가능한 문자는 점으로 대체됩니다.
abcdefghijk 이면 abcdefghij. 처럼 최대 10개만 띄움
Then the program will prompt again for the index of the desired entry and
displays the contact’s information, one field per line. If the input makes no
sense, define a relevant behavior.
그 다음 사용자가 원하는 인덱스를 입력받고 그에 해당하는 연락처의 정보를 한줄에 하나씩 출력. 입력이 이상할 경우 관련된 행동을 정의.
• Else the input is discarded.
다른 입력은 무시됩니다.
When a command has been correctly executed, the program waits for another ADD or
SEARCH command until an EXIT command.
명령어가 올바르게 들어오고 실행되면 프로그램은 EXIT가 들어올 때 까지 ADD 또는 SEARCH 명령을 기다림
Turn-in directory : ex02/
Files to turn in : Makefile, Account.cpp, Account.hpp, tests.cpp
Forbidden functions : None
It’s your first day of work at GlobalBanksters United. You successfully passed the
hiring tests for the programmers’ team thanks to a few tricks with Microsoft Office
a friend showed you. But you know that it was your swift installation of Adobe Reader
that blew your recruiter’s mind. This gave you the little edge needed to beat your opponents for this job.
Anyway, you made it and your boss gave you your first task. You need to recode one
missing source file because something went wrong. Account.cpp is missing and they use
USB file sharing and not git.
어쨋든, 너에게 사장이 첫번째 임무를 주었고, 너는 하나를 다시 코딩해야합니다. 문제가 발생하여 소스 파일이 누락되었습니다. Account.cpp가 누락되어 사용합니다. git이 아닌 usb파일 공유.
At this point, it will be legitimate to quit this place however for the sake of this
exercise, you will stay.
이 포인트는, 이 곳을 떠나는 것이 합법적이지만, 이 예제를 위해 너는 남아있을수 있습니다.
The Account.hpp file is present and a quick compilation of tests.cpp confirms that
an Account.cpp file is missing. There’s also an old output log that seems to contain the
matching output.
account.hpp 파일은 선물이다. 그리고 빠른 테스트 컴파일이 있습니다. tests.cpp는 account.cpp파일이 없는지 확인합니다. 그들은 또한 일치하는 출력을 포함하는 것으로 보이는 이전 출력 로그도 있습니다.
So you need to create a Account.cpp file and quickly write some lines of pure awesome
C++ and after a couple of failed compilations, your program will compiles and passes the
tests with a perfect output, except for the timestamps differences. Damn you’re good!
따라서 너는 account.cpp 생성이 필요하다. 몇 줄의 멋진 c++를 빠르게 작성하고, 몇 번의 컴파일 실패 후, 프로그램은 timestamps를 제외하고 완벽한 출력으로 테스트를 컴파일하고 통과합니다. 니가 좋다.
참고 : https://www.notion.so/skamo/CPP_MODULE-d127f182fb4340669314cf9354d303d8
해석이 애매한 부분이나, 잘 모르겠는 부분은 동료카뎃인 skamo님의 글을 참고했습니다. 감사합니다