Newbie best notes

Revision en92, by arefin_hossain, 2022-01-15 22:23:37

Language using with: C

  1. Datatype resource
  2. BASIC OF VARIABLE & CONSTANT resource
  3. OPERATOR resource
  4. TYPECASTING resource
  5. LIBRARY-FUNCTION resource
  6. RELATIONAL AND- LOGICAL OPERATORS resource
  7. IF-ELSE STATEMENT resource
  8. TYPE-CASTING resource
  9. POST & PRE-INCREMENT resource
  10. TERNARY-OPERATOR resource
  11. PATTERN PRINTING resource Youtube
  12. BASIC DATATYPES{*char} class
  13. SWITCH-CONTINUE- GOTO-DO.WHILE class
  14. ARRAY class:1D class:2D Youtube
  15. STRING Youtube class:2D
  16. FUNCTION resource
  17. RECURSSION class:1 class:2
Try to solve this problem using with Loop:

219432Y-Easy Fibonacci

Code

219432J-Primes from 1 to n

Code

219432G-Factorial

Code

219432I-Palindrome

Code

219432L-GCD

Code

---------------------------------------------------------------

Try to solve this proble using with Array:

219774D-Positions in array

Code

219774E-Lowest Number

Code

219774F-Reversing

Code

219774H-Sorting

Code

219774L-Max Subarray

Code

219774M-Replace MinMax

Code

219774S-Search In Matrix

Code

219774V-Frequency Array

Code

219774Z-Binary Search

Code

--------------------------------------------------------------------

Try to solve this proble using with String:

219856C-Compare

Code

219856F-Way Too Long Words

Code

219856H-Good or Bad

Code

219856J-Count Letters

Code

219856K-I Love strings

Code

219856L-String Functions

Code

219856O-Sort String

Code

219856R-String Score

Code

--------------------------------------------------------------------

Try to solve this proble using with Function:

223205D-Prime Function

Code

22320E-Swap

Code

22320G-Max and MIN

Code

22320K-Shift Right

Code

---------------------------------------------------------------

Try to solve this proble using with Recurssion:

223339C-Print from N to 1

Code

223339D-Print Digits using Recursion

Code

223339E-Base Converssion

Code

223339J-Factorial

Code
Try to solve this proble using with File,Structure:

FILEHANDLING Part1: https://drive.google.com/file/d/1CruWbmNeGhlfzkotfXkc7q_9ALrOPhkK/view Part2: https://drive.google.com/file/d/1ctQXf2IVzYLHxy9eD_ICwR_P--EFaAu-/view Part3: https://drive.google.com/file/d/1NJ-r6u-hQ_5mdfgOvVPNDmgaPo3EEoOY/view Suppose, you are a software engineer at Google and responsible for creating a basic version of Google Classroom. There could be information of thousands of courses. Each course may contain several students and only one instructor/teacher. For each course, you have to keep a record of its Course Code, Course Name, Section, Instructor’s Name, Number of Enrolled Students and a list of the IDs of the enrolled students. You have to save the information of all the courses in a file named “classDB.txt”. Here is a sample for the “classDB.txt” file. We will refer to this in question 1, 2 and 3.

CSE-1121 Computer Programming 1 B JAA 4 C213050 C213052 C213055 C213063

MATH-1107 Mathematics 1 C MRI 3 C213091 C213092 C213099

CSE-2311 Data Structure A MSA 5 C211001 C211010 C211015 C211021 C211030

CSE-4875 Pattern Recognition and Fuzzy System A JAA 0 CSE-1121

Computer Programming 1 C JAA 3 C213091 C213092 C213099

Following is an explanation for a particular course information. Consider the first one:

CSE-1121 Computer Programming 1 B JAA 4 C213050 C213052 C213055 C213063

Here the first string “CSE-1121” represents the Course Code of the course. The second, third and fourth lines represent the Course Name, Section and Instructor’s Name of the course respectively. The fifth line contains an integer representing the number of enrolled students that this particular course has (in this case 4 students have enrolled for CSE-1121, Section-B). And next line is a list containing the student IDs of the enrolled students. If there are no enrolled students then the fifth line should contain 0 and the nextline will be the beginning of another record [See the record of “CSE-4875”, forexample]. Now build a system where you will be given information of several courses. You have tosave information of all the courses in a file named “classDB.txt”.

  1. a) Create a structure called Course which will contain necessary fields to hold theinformation of a particular Course. Use an array of type of this structure to solve theproblems in questions 1-b and 1-c. b) Show Course Code, Course Name, Section and Number of Enrolled Students of all courses taken by a particular teacher. Suppose you are given “JAA” as input. Considering the file “classDB.txt”, the following should be the output:

    Code: CSE-1121
                                     Name: Computer Programming 1
                                     Section: B
                                     Number of Students: 4
    
                                     Code: CSE-4875
                                     Name: Pattern Recognition and Fuzzy System
                                     Section: A
                                     Number of Students: 0
    
                                     Code: CSE-1121
                                     Name: Computer Programming 
                                     Section: C
                                     Number of Students: 3

c) Add information of a new course to the “classDB.txt” file. Make a function named addInfo() to do so. If the “classDB.txt” file doesn’t exist on the machine, create a new file with this name. This function should take all the necessary inputs i.e. Course Code, Course Name, Section, Instructor’s Name from the keyboard. Initially the Number of Enrolled Students should be 0.

  1. a) Suppose you are given the matric ID of a student, a particular Course Code and Section as input. Now add this student to this particular course i.e. the matric ID should now appear on the enrolled student ID list of this course and the total number of enrolled students should increase by 1. For the following input “C213070 CSE-1121 B”, the first course info in the “classDB.txt” file should change into:

    CSE-1121
       Computer Programming 1
       B
       JAA
       5
       C213050 C213052 C213055 C213063 C213070

b) Delete information of all the courses that has no students enrolled yet. Considering the “classDB.txt” file only the information of the course CSE-4875 will be deleted in this case.

**POINTER**

Agenda: 1.Pointer and its basics 2. Benefits of pointer — swap function and using & in scanf function 3. Pointer Arithmetic 4. Arrays are pointers!! (But less powerful.

*pointer with address check:

Explaination: •(int *p) is a pointer, where (&c) is located it. •(*p /*p==p[0] /p[0]) both of them denote is simillar. •[+]symbol denoted backward address; [-]>>frontward. •int pointer allocated -4 byte of memory, char=1 byte,double=8byte.

*Array is one of pointer.

*String is one kind of char Array. So, its deserves a address hold. So that, we write: (“%s”, str) …no necessary write: &str! *We know, str cnt in [0]-index. If we need [1] index to it starting than write this approach: (str+1)=[1-index]. *(&str[1])..hcce atr alternative notation! *Normal array has less power as a pointer! If array we don’t directly exchange one var it for others. But, pointer is it plus point!

**BITWISE OPERATOR**

https://www.tutorialspoint.com/cprogramming/c_bitwise_operators.htm *Binary Operator work with around of two-operand: AND(&)---If both of them Var is 1, than write=’1’ else =’0’ OR(||) ---If both of them Var has One value is 1, than write=’1’ else =’0’ XOR(^) ---If both of them is similar than write=’0’ else =’1’ *Unary operator work with 1 var. Ex: () NOT(~) ---If both of them is similar than write=’0’ else =’1’

Tags fibonacci sequence, prime numbers, factorial, palindrome, gcd, array possition, reverse array, lowest array, reversing, sorting, max subarray, search in matrix

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en96 English arefin_hossain 2022-01-15 22:37:38 12
en95 English arefin_hossain 2022-01-15 22:36:05 181
en94 English arefin_hossain 2022-01-15 22:33:22 45
en93 English arefin_hossain 2022-01-15 22:31:53 369
en92 English arefin_hossain 2022-01-15 22:23:37 6067
en91 English arefin_hossain 2022-01-14 09:18:38 3027
en90 English arefin_hossain 2022-01-14 09:08:30 4342
en89 English arefin_hossain 2022-01-13 21:49:56 5444
en88 English arefin_hossain 2022-01-12 23:26:42 18
en87 English arefin_hossain 2022-01-12 23:25:55 15
en86 English arefin_hossain 2022-01-12 23:24:58 157
en85 English arefin_hossain 2022-01-12 23:22:56 3851
en84 English arefin_hossain 2022-01-12 23:06:47 157
en83 English arefin_hossain 2022-01-12 23:04:45 224
en82 English arefin_hossain 2022-01-12 23:03:04 78
en81 English arefin_hossain 2022-01-12 23:01:09 86
en80 English arefin_hossain 2022-01-12 23:00:05 87
en79 English arefin_hossain 2022-01-12 22:59:08 9 Tiny change: 'DymW0hN)\n\n\n\n<h5>' -> 'DymW0hN)\n15 arrrra\n\n\n<h5>'
en78 English arefin_hossain 2022-01-12 22:58:34 12
en77 English arefin_hossain 2022-01-12 22:57:57 1477
en76 English arefin_hossain 2022-01-12 22:51:07 1149 Tiny change: 'oblem/L)\n\n<spoiler' -> 'oblem/L)\n<spoiler' (published)
en75 English arefin_hossain 2022-01-12 22:40:15 17 Tiny change: 'oblem/L)\n\n<spoiler' -> 'oblem/L)\n<spoiler' (saved to drafts)
en74 English arefin_hossain 2022-01-12 22:34:01 5 Tiny change: 'oblem/L)\n\n<spoiler' -> 'oblem/L)\n<spoiler'
en73 English arefin_hossain 2022-01-12 22:32:21 41
en72 English arefin_hossain 2022-01-12 22:27:58 11
en71 English arefin_hossain 2022-01-12 22:23:51 69 (published)
en70 English arefin_hossain 2022-01-12 22:19:24 769 (saved to drafts)
en69 English arefin_hossain 2022-01-12 22:05:49 4
en68 English arefin_hossain 2022-01-12 22:04:35 504 (published)
en67 English arefin_hossain 2022-01-12 21:55:23 187 (saved to drafts)
en66 English arefin_hossain 2022-01-12 21:49:58 427
en65 English arefin_hossain 2022-01-12 21:46:38 509
en64 English arefin_hossain 2022-01-12 21:41:54 352
en63 English arefin_hossain 2022-01-12 21:37:19 34
en62 English arefin_hossain 2022-01-12 21:35:37 256
en61 English arefin_hossain 2022-01-12 21:32:40 92
en60 English arefin_hossain 2022-01-12 21:31:37 725
en59 English arefin_hossain 2022-01-12 21:27:02 199
en58 English arefin_hossain 2022-01-12 21:24:01 7
en57 English arefin_hossain 2022-01-12 21:23:13 10
en56 English arefin_hossain 2022-01-12 21:21:00 524
en55 English arefin_hossain 2022-01-11 22:59:27 21 Reverted to en53
en54 English arefin_hossain 2022-01-11 22:56:31 21 Reverted to en52
en53 English arefin_hossain 2022-01-11 22:50:17 21 Tiny change: '="Code">\n<h6>\n #include<s' -> '="Code">\n <h6>#include<s'
en52 English arefin_hossain 2022-01-11 22:48:32 64 Tiny change: '="Code">\n<h6>\n #include<s' -> '="Code">\n <h6>#include<s'
en51 English arefin_hossain 2022-01-11 22:47:15 8 Tiny change: '="Code">\n<h6>\n #include<s' -> '="Code">\n <h6>#include<s'
en50 English arefin_hossain 2022-01-11 22:46:03 7 Tiny change: '="Code">\n<h6>\n #include<s' -> '="Code">\n <h6>#include<s'
en49 English arefin_hossain 2022-01-11 22:44:19 6 Tiny change: '="Code">\n<h6>\n #include<s' -> '="Code">\n <h6>#include<s'
en48 English arefin_hossain 2022-01-11 22:43:49 185
en47 English arefin_hossain 2022-01-11 22:42:20 27
en46 English arefin_hossain 2022-01-11 22:41:36 9
en45 English arefin_hossain 2022-01-11 22:39:50 137
en44 English arefin_hossain 2022-01-11 22:38:34 0 for(i=1; i<=n-2; i++)\n{ c = a + b;\nprintf(" %d", c);\na = b;\nb = c;\n}
en43 English arefin_hossain 2022-01-11 22:37:19 117 Tiny change: ', c, i, n;\n\n sc' -> ', c, i, n; \n\n sc'
en42 English arefin_hossain 2022-01-11 22:32:26 11 Tiny change: ', c, i, n;\n\n sc' -> ', c, i, n; \n\n sc'
en41 English arefin_hossain 2022-01-11 22:28:47 4 Tiny change: ', c, i, n;\n\n sc' -> ', c, i, n; \n\n sc'
en40 English arefin_hossain 2022-01-11 22:28:16 4 Tiny change: ', c, i, n;\n\n sc' -> ', c, i, n; \n\n sc'
en39 English arefin_hossain 2022-01-11 22:27:40 7 Tiny change: ', c, i, n;\n\n sc' -> ', c, i, n; \n\n sc'
en38 English arefin_hossain 2022-01-11 22:27:00 213 \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
en37 English arefin_hossain 2022-01-11 22:24:00 16
en36 English arefin_hossain 2022-01-11 22:22:20 26 Tiny change: '"aaa">\n<h1>stdio.h</h1>\n\n</spo' -> '"aaa">\n<h6>stdio.h</h6>\n\n</spo'
en35 English arefin_hossain 2022-01-11 22:18:57 168 Tiny change: '"aaa">\n<h1>stdio.h</h1>\n\n</spo' -> '"aaa">\n<h6>stdio.h</h6>\n\n</spo'
en34 English arefin_hossain 2022-01-11 22:17:38 4 Tiny change: '"aaa">\n<h1>stdio.h</h1>\n\n</spo' -> '"aaa">\n<h6>stdio.h</h6>\n\n</spo'
en33 English arefin_hossain 2022-01-11 22:17:15 12
en32 English arefin_hossain 2022-01-11 22:16:11 54
en31 English arefin_hossain 2022-01-11 22:13:46 4
en30 English arefin_hossain 2022-01-11 22:13:01 1414
en29 English arefin_hossain 2022-01-11 22:10:26 1194
en28 English arefin_hossain 2022-01-11 22:08:57 219
en27 English arefin_hossain 2022-01-11 22:06:40 34
en26 English arefin_hossain 2022-01-11 22:04:52 44
en25 English arefin_hossain 2022-01-11 22:03:45 368
en24 English arefin_hossain 2022-01-11 22:00:41 480
en23 English arefin_hossain 2022-01-11 21:58:46 79
en22 English arefin_hossain 2022-01-11 21:57:52 51
en21 English arefin_hossain 2022-01-11 21:56:15 385
en20 English arefin_hossain 2022-01-11 21:54:36 22
en19 English arefin_hossain 2022-01-11 21:53:49 94
en18 English arefin_hossain 2022-01-11 21:48:30 7
en17 English arefin_hossain 2022-01-11 21:47:31 5
en16 English arefin_hossain 2022-01-11 21:45:47 106
en15 English arefin_hossain 2022-01-11 21:43:36 11
en14 English arefin_hossain 2022-01-11 21:39:52 74
en13 English arefin_hossain 2022-01-11 21:38:47 16 Tiny change: ' Fibonacci](219432Y)\n\n\n\n\n' -> ' Fibonacci:219432Y - 14]\n\n\n\n\n'
en12 English arefin_hossain 2022-01-11 21:37:25 38
en11 English arefin_hossain 2022-01-11 21:34:22 402
en10 English arefin_hossain 2022-01-11 21:32:15 407
en9 English arefin_hossain 2022-01-11 21:30:22 540
en8 English arefin_hossain 2022-01-11 21:27:10 81
en7 English arefin_hossain 2022-01-11 21:26:22 137
en6 English arefin_hossain 2022-01-11 21:24:04 73
en5 English arefin_hossain 2022-01-11 21:18:18 34
en4 English arefin_hossain 2022-01-11 21:15:10 64
en3 English arefin_hossain 2022-01-11 21:10:03 386
en2 English arefin_hossain 2022-01-11 21:07:17 102 (published)
en1 English arefin_hossain 2022-01-11 19:56:43 1073 Initial revision (saved to drafts)