본문 바로가기

분류 전체보기

(15)
[Day 15] How to use one-dimensional array In this class, I learned about one-dimensional array for containing the values. Unlike general variables, one-dimensional arrangement can be accessed through an index to each space. For example, if you declare five variables, each variable must be defined with a specific value. However, if you declare a 1D array with five spaces only once, each value can be accessed through an index. /* General ..
[Day 14] 'Number Baseball Game' in C Programming Today's lecture covered how to make a code for 'Number Baseball Game' in C Programming. Here's the rules of 'Number Baseball Game' as below. 1. Generate 3 digits randomly 2. Enter 3 digits to get the right answer. 3. If the digit position and value of the entered number are the same, it is considered a strike. 4. The digit position of the entered number is different, but if the value is the same..
[Day 13] Repeated Statement: for and while I learned the 'for' and 'while' repeated statement which is used to repeatedly command a particularly actions. 1. 'For' statement This iteration operates the action code while satisfying the conditional expression from the initial condition of the variable. #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, ch..
[Day 12] Conditional Statement 2: switch - case In this class, I learned the conditional statement 'Switch' case. When setting conditions for an specific action, 'Switch' case complete the condition statement by directly specifying each condition. #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char *argv[]) { switch(value) { case value1: action1; break;..
[Day 11] Conditional Statement 1: if and else I learned the conditional statement including 'if' and 'else'. When setting conditions for an action, we can define the action by dividing it into 'if', 'elseif', and 'else' syntax. #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char *argv[]) { if (Condition 1) { Action 1; } else if (Condition 2) { Action ..
[Day 10] Operator 3: Bitwise Shift Operator In this class, I learn the bitwise shift operator including ''. 1. Right-shift operator (>>) - The right-shift operator ( 2; printf('%x', A); return 0; } The results showed 'A' as 0b0010 that which resulted in change of 2^(-2). 2. Left-shift operator (
[Day 9] Operator 2: Logical Operators and Bit operators in C Language In this class, I learned about the logical operators (e.g. &&, ||, !) and bit operators (&, |, ~, ^). 1. Logical operators - AND (&&): If A and B are true, it is denoted as 'A && B' - OR (||): If A or B are true, it is denoted as 'A || B' - NOT (!): Non-A values output as a result, it is denoted as '!A' #include #include /* run this program using the console pauser or add your own getch, system(..
[Day 8] Operator 1: Assignment, Relational, Arithmetic, Incremental Operators in C Language In this class, I learned about the operators that enable calculate or compare the variables. Here's four types of operators that easily classified to explan their functions. 1. Assignment operator - 'A = B' means that value 'B' should be assigned to variable 'A' #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int arg..