카테고리 없음
C++ 주석, 변수, cout, cin에 관하여
Ryuha류하
2021. 2. 8. 17:22
#include <iostream> //cout, cin, endl, ...
#include <cstdio>
int main()
{
/*
할당하는 방법이 다름
생성자 소멸자 assign operator 같은 것 할 때 혼란이 생길 수 있음.
*/
int x = 123; //initialization
x = 112; //assignment
std::cout << x << std::endl;
//std::cout << &x << std::endl; //&ersand 라는 기호 주소를 나타내준다.
std::cout << "I love this lecture!" << std::endl; //std이름 공간안에 있는 cout을 사용하는 것
std::cout << "x is " << x << "pi is " << std::endl;
using namespace std; // 여기 밑으로는 std를 사용하지 않아도 컴퓨터가 알아서 찾음
cout << "abc"
<< "\t"
<< "def" << endl;
cout << "ab"
<< "\t"
<< "cdef" << endl; //\t는 동일하게 tab 해주고 하나의 기능으로 작용한다.
cout << "empty \a"; // \n : 엔터, \a : 소리를 나타내줌
//cin 입력을 받는 것
int y;
cin >> x;
cout << "Your input is " << x << endl;
return 0;
}
/*
the way of making visual studio code stop running mac
control + option + m
*/
C++의 변수 활용
std를 통한 cout, cin 활용
주석에 관하여 작성하였습니다.