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++