본문 바로가기

::public265

string #include #include using namespace std; int main() { { string str = "abcd"; cout 2020. 7. 13.
문자열 #pragma warning(disable: 4996)#include #include using namespace std; int main(){ { char str[] = "abc"; cout 2020. 7. 13.
다차원 배열 #include using namespace std;int main(){ { // bool이 31개 있는 배열 bool attendanceBook[31]; // bool, bool, bool ... bool (*31) attendanceBook[0]; // 배열의 맨 앞 값 (0) attendanceBook[30]; // 배열의 맨 뒤 값 (SIZE - 1) attendanceBook[-1]; // 정의 되지 않은 행동, 음수 (컴파일 됨) attendanceBook[31]; // 정의 되지 않은 행동, 사이즈 초과 (컴파일 됨) } { int arraySize; cin >> arraySize; // 변수로 배열 사이즈를 지정할 수 없다 // bool attedanceBook[arraySize]; } {.. 2020. 7. 13.
배열(Array) #include using namespace std; int main(){ { // bool이 31개 있는 배열 bool attendanceBook[31]; // bool, bool, bool ... bool (*31) attendanceBook[0]; // 배열의 맨 앞 값 (0) attendanceBook[30]; // 배열의 맨 뒤 값 (SIZE - 1) attendanceBook[-1]; // 정의 되지 않은 행동, 음수 (컴파일 됨) attendanceBook[31]; // 정의 되지 않은 행동, 사이즈 초과 (컴파일 됨) } { int arraySize; cin >> arraySize; // 변수로 배열 사이즈를 지정할 수 없다 // bool attedanceBook[arraySize]; } .. 2020. 7. 13.
비트연산자 #include using namespace std; int main(){ { // Not 연산자(~) // 0 -> 1 // 1 -> 0 } { // 0000,0000,0000,0000,0000,0000,0000,0000 (0) int num = 0; // 1111,1111,1111,1111,1111,1111,1111,1111 (-1) cout 2020. 7. 3.
비교연산자 #include using namespace std; int main(){ { // AND 연산자(&&) // true && true == true // true && false == false // false && true == false // false && false == false } { int num0 = 10, num1(10); int num2 = 20, num3(30); if (num0 == num1 && num2 != num3) // == 연산자가 &&보다 우선 순위가 높다 cout 2020. 7. 3.