Desc :
char 문자형
int 정수형
double , float 실수형
bool 논리형 - true, false 둘 중 하나의 값
string 문자열 --> 문자형 자료형 string 사용하기 위한 해더 파일 <string>
Source Code :
#include <iostream>
#include <string>
using namespace std;
int main()
{
char ch = 'C';
int integer = 100;
double pi = 3.141592;
bool is_true = true;
string word = "Hello string";
cout << "char: " << ch << endl;
cout << "int: " << integer << endl;
cout << "double: " << pi << endl;
cout << "bool: " << is_true << endl;
cout << "string: " << word << endl;
return 0;
}
Result :
'C++' 카테고리의 다른 글
[C++] 009 순환문 (0) | 2021.01.22 |
---|---|
[C++] 008 조건문 (0) | 2021.01.22 |
[C++] 006 사칙연산 축약 (0) | 2021.01.22 |
[C++] 005 사칙연산 (0) | 2021.01.22 |
[C++] 004 상수 (0) | 2021.01.22 |