### Noob_Cooder71's blog

By Noob_Cooder71, history, 12 days ago,

## 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
12. BASIC DATATYPES{*char} class
13. SWITCH-CONTINUE- GOTO-DO.WHILE class
16. FUNCTION resource

Code

Code

Code

Code

Code

Code

Code

Code

Code

Code

Code

Code

Code

Code

Code

Code

Code

Code

Code

Code

Code

Code

Code

Code

Code

Code

## ---------------------------------------------------------------

Code

Code

Code

#### 223339J-Factorial

Code
##### Try to solve this proble using with File,Structure:
FILEHANDLING
Part1:  https://drive.google.com/file/d/1CruWbmNeGhlfzkotfXkc7q_9ALrOPhkK/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.

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.

2. 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.

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: (~a,2022-01-15)
NOT(~)  ---If both of them is similar than write=’0’ else =’1’