728x90
반응형
https://www.onlinegdb.com/online_c_compiler
/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
#include <numeric>
// #include <namespace>
using namespace std;
int main()
{
std::cout<<"Hello World" << std::endl;
int x = 1, y(4);
std::cout << x << "\n" << y << std::endl;
// int num0 = 1;
// int num1 = num0 * 1.5;
// int num2 = num0 / 2;
// int num3 = num2*3;
int num0 = 11; // 10진수
int num1 = 011; // 8진수
int num2 = 0b11; // 2진수
int num3 = 0x11; // 16진수
std::cout << num0 << std::endl;
std::cout << num1 << std::endl;
std::cout << num2 << std::endl;
std::cout << num3 << std::endl;
// signed 부호가 있는
// unsigned 부호가 없는
// short : 2 byte
// int : 4 byte
int intNum = 0;
long longNum = 0;
int* intPointer = &intNum;
long* longPointer = &longNum;
cout << sizeof(intNum) << endl;
cout << sizeof(longNum) << endl;
cout << sizeof(intPointer) << endl;
cout << endl;
// Overflow Example
uint32_t num32 = numeric_limits<uint32_t>::max();
uint32_t num32_ = num32 + 1;
cout << num32 << endl;
cout << num32_ << endl;
int32_t inum32 = numeric_limits<int32_t>::min();
int32_t inum32_ = inum32 - 1;
cout << inum32 << endl;
cout << inum32_ << endl;
// Switch
char selection;
cout << "Who's the best player in the position? (FW, MF, DF, GK) : " << endl;
cin >> selection;
switch (selection)
{
case 'F':
case 'f':
cout << "11. Kim In-Gyun" << endl; break;
case 'M':
case 'm':
cout << "73. Lee Jun-Gyu" << endl; break;
case 'D':
case 'd':
cout << "33.Lee Jeong-Taek" << endl; break;
case 'G':
case 'g':
cout << "1. Lee Chang-Geun" << endl; break;
default:
cout << endl;
}
// int num4;
// cin >> num4;
// do {
// if (num4%3==0)
// break;
// if (num4%5==0)
// break;
// cout << "통과" << endl;
// } while (false);
// cout << "끝" << endl;
int num5;
cin >> num5;
do {
if (num5%3==0)
cout << "이것은 do-while문, 3로 나눠집니다." << endl;
break;
if (num5%5==0)
cout << "이것은 do-while문, 5로 나눠집니다." << endl;
break;
cout << "3 또는 5로 나눠지지 않습니다." << endl;
} while (false);
return 0;
}
728x90
반응형