Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

C++ Programming - 1st Study

C 프로그래밍을 안다는 기준으로 작성한 C++ 프로그래밍 자료입니다. 처음 배우는 사람들을 기준으로 작성한 자료도 차후에 올릴 예정입니다.

  • Identifiez-vous pour voir les commentaires

C++ Programming - 1st Study

  1. 1. 3
  2. 2. #include <stdio.h> int main() { printf("Hello, World!"); return 0; } #include <iostream> int main() { std::cout << "Hello, World"; return 0; } C C++ 4
  3. 3. #include <stdio.h> int main() { int x = 10, y = 20; printf("x = %d, y = %dn", x, y); return 0; } #include <iostream> int main() { int x = 10, y = 20; std::cout << "x = " << x << ", y = " << y << std::endl; return 0; } C C++ 5
  4. 4. #include <stdio.h> int main() { int x = 0; printf("Input the number: "); scanf("%d", &x); printf("x = %dn", x); return 0; } #include <iostream> int main() { int x = 0; std::cout << "Input the number:"; std::cin >> x; std::cout << "x = " << x << std::endl; return 0; } C C++ 6
  5. 5. 8
  6. 6. #include <stdio.h> int main() { int i = 1; if (i) printf("i is true!n"); else printf("i is false!n"); return 0; } #include <iostream> int main() { bool b = true; if (b) std::cout << "b is true!" << std::endl; else std::cout << "b is false!" << std::endl; return 0; } C C++ 9
  7. 7. #include <iostream> int main() { bool b = true; std::cout << b << std::endl; std::cout << !b << std::endl; return 0; } 10
  8. 8. #include <iostream> int main() { bool b = true; std::cout.setf(std::ios::boolalpha); std::cout << b << std::endl; std::cout << !b << std::endl; std::cout.unsetf(std::ios::boolalpha); std::cout << b << std::endl; std::cout << !b << std::endl; return 0; } 11
  9. 9. 13
  10. 10. #include <iostream> int main() { int i1 = 10; double d1 = 3.14; return 0; } #include <iostream> int main() { auto i2 = 10; auto d2 = 3.14; return 0; } C++98 C++11 14
  11. 11. #include <iostream> #include <vector> #include <string> #include <tuple> int main() { std::vector<std::tuple<std::string, int, double>> vStudents; for (std::vector<std::tuple<std::string, int, double>>::iterator iter = vStudents.begin(); iter != vStudents.end(); ++iter) { … } return 0; } C++98 15
  12. 12. #include <iostream> #include <vector> #include <string> #include <tuple> int main() { std::vector<std::tuple<std::string, int, double>> vStudents; for (auto iter = vStudents.begin(); iter != vStudents.end(); ++iter) { … } return 0; } C++11 16

×