Chapter 1 ¶
중요 소스 ¶
~cpp
// ask for the person's name, and greet the person
#include <iostream>
#include <string>
int main() {
// ask for the person's name
std::cout << "Please enter your first name: ";
// read the name
std::string name;
std::cin >> name;
// write a greeting
std::cout << "Hello, " << name << "!" << std::endl;
return 0;
}
----
~cpp
// ask for the person's name, and generate a framed greeting
#include <iostream>
#include <string>
int main() {
std::cout << "Please enter your first name: ";
std::string name;
std::cin >> name;
// build the message that we intend to write
const std::string greeting = "Hello, " + name + "!";
// build the second and fourth lines of the output
const std::string spaces(greeting.size(), ' ');
const std::string second = "* " + spaces + " *";
// build the first and fifth lines of the output
const std::string first(second.size(), '*');
// write it all
std::cout << std::endl;
std::cout << first << std::endl;
std::cout << second << std::endl;
std::cout << "* " << greeting << " *" << std::endl;
std::cout << second << std::endl;
std::cout << first << std::endl;
return 0;
}
----
KeyWords ¶
Variable, Object, definition, local variable, destroy
interface : 객체의 타입으로 묵시적으로 내포 되어 있는 것은 인터페이스로서, 해당 타입의 객체에 사용 가능한 연산(operation)들의 집합을 말합니다. name을 string 타입의 변수(이름 있는 객체)로 정의 하게 되며, 우리는 string으로 할 수 있는 모든 일들을 name으로 하고 싶다는 뜻을 묵시적으로 내포하게 됩니다.
초기화, end-of-file, buffer, flush, overload, const, associativity(결합방식), 멤버함수, 기본 내장 타입, 기본타입(built-in type)
----
AcceleratedC++
interface : 객체의 타입으로 묵시적으로 내포 되어 있는 것은 인터페이스로서, 해당 타입의 객체에 사용 가능한 연산(operation)들의 집합을 말합니다. name을 string 타입의 변수(이름 있는 객체)로 정의 하게 되며, 우리는 string으로 할 수 있는 모든 일들을 name으로 하고 싶다는 뜻을 묵시적으로 내포하게 됩니다.
초기화, end-of-file, buffer, flush, overload, const, associativity(결합방식), 멤버함수, 기본 내장 타입, 기본타입(built-in type)
----
AcceleratedC++










