C++ Basic 2018 (Batch-2)
765 subscribers
277 photos
11 videos
30 files
74 links
🎯 C++ Basic 2018 (Batch 2) - Pre-Engineering Edition
My second family of coders! πŸ‘¨β€πŸŽ“πŸ‘©β€πŸŽ“
Specifically for 2018 pre-engineering students finding C++ challenging.
We turn confusion into clarity, one concept at a time.
Join the struggle bus - destination
Download Telegram
βœ…Exercise
Write an algorithm to find the largest of three numbers?

@ProgrammingWithFaith2018
❀2
To excel in questions like this, you should first understand the problem.

β–Žβœ… Algorithm Representation

An algorithm can be represented using both flowcharts and pseudocode.

β€’ Flowchart: This represents the algorithm using various shapes:
  – Oval for Start/End
  – Rectangle for Operations
  – Parallelogram for Input/Output
  – Diamond for Decision-making

β€’ Pseudocode: This represents the algorithm using text-based instructions, similar to English words.

β–ŽHint

To compare three numbers, we should first accept input from the user.

β–ŽPseudocode

Step 1: Start
Step 2: Input three numbers X, Y, and Z
Step 3: If X > Y then go to Step 5.
Step 4: If Y > Z then
            Print "Y is the largest"
        Else
            Print "Z is the largest"
        ENDIF
        Go to Step 6
Step 5: If X > Z then
            Print "X is the largest"
        Else
            Print "Z is the largest"
        ENDIF
Step 6: Stop


Flowchart

1. Start: Use an oval shape to represent the start of the process.
2. Input: Use a parallelogram to indicate where the user inputs three numbers (X, Y, Z).
3. Decision (Diamond): Use a diamond shape for the first comparison (Is X > Y?).
   – Yes: If true, go to another decision diamond (Is X > Z?).
     β–ͺ Yes: Print "X is the largest" (parallelogram).
     β–ͺ No: Print "Z is the largest" ( parallelogram).
   – No: Go to the next decision diamond (Is Y > Z?).
     β–ͺ Yes: Print "Y is the largest" (parallelogram).
     β–ͺ No: Print "Z is the largest" (parallelogram).
4. End: Use an oval shape to represent the end of the process.

@ProgrammingWithFaith2018
❀6
❀4
βœ…Exercise: Increment and Decrement


‎1. int a=5;
‎  int  x=++a + ++a;
‎  cout<<x;


‎2. int a=5;
‎   int b=6;
‎   Cout<< ++a + b++;
‎   Cout<<b;

‎3. int x, a, b, c;
‎a = 2;
‎b = 4;
‎c = 5;
‎x = a--+ b++ -++c;
‎cout<<x;

‎4. int x, a;
‎a = 2;
‎x = ++a *--a *++a;
‎cout<<x;

‎5. int x, a = 4;
‎x = ++a + ++a + ++a;

‎cout<<x;

@ProgrammingWithFaith2018
❀3πŸ”₯2
βœ… ‎Hint:‎One variable can't store two value at the same time.


1.int a=5;
‎int x=++a + ++a;
‎(6+ ++a)
‎(7+7) because one variable can't hold two different value , (6 and 7 ) at the same time so it become 7.

‎7+7=14


Answer 14


2.int a=5;
‎   int b=6;
‎   
‎   Cout<<++a +b++// post and pre increment .
‎  6+6 // after this line b will be 7
‎Cout<<++a +b++;  (6+6)
‎  =12
‎Cout<<b;
‎=7


answer=12 and 7


3.int x,a,b,c;
‎a=2;
‎b=4;
‎c=5;
‎x=a-- + b++ - ++c;

‎(2+4)-6
‎=6-6=0
‎cout<<x;  


Answer   0


4.int x,a;
‎a=2
‎x=++a *--a* ++a
‎(3*2) * ++a , but one variable can't hold two values at the same time.

‎So, (2*2)*++a
‎    (4*3)=12

‎cout<<x;// 12


Answer 12



5.int x,a=4;
‎x=++a + ++a + ++a;

‎(++a + ++a) + ++a
‎(5+6) + ++a but we can't store two value at one variable at the same time.

‎So,
‎(6+6)+ ++a
‎(12)+ 7


Answer 19


@ProgrammingWithFaith2018
❀5πŸ”₯3😁1
If you ever find it difficult to understand questions and concepts like these, join our premium class. We make everything easy to understand for you.

βœ…For registration:[ @ProgrammingWithFaith_bot ]
❀1
🎲 Quiz 'C++ Chapter One'
πŸ–Š 16 questions Β· ⏱ 1 min
πŸ”₯2❀1
To register for the premium class, πŸ‘‰ [@ProgrammingWithFaith_bot] πŸŽ‰
πŸ”₯1
Do you have any questions? πŸ€” Just ask me anonymously, and I will answer them here!πŸ’¬πŸ˜Š
link: [ https://sma.robi.work/b/bqkJIHVlXiTl ]
❀1πŸ‘1
u forgot to include return 0: and } 🀭
😁2
I recommend that u study based on the exam format, and to be good at programming, you should understand the theory first. Once you grasp how things work, it will become easier.
❀4
Computer Science
❀2
For now, I haven't built a very strong portfolio, but I can show you some of my projects.
https://movie-review-app-pi-two.vercel.app/

For more , you can join my personal channel where I share what I do. @SelfTaughtDev1
❀1
Do you have a Telegram channel? Are you already monetizing it? πŸ€” Try Inside Ads β€” I’ve already started earning. Here’s the link:

https://t.me/InsideAds_bot/open?startapp=r_1876122021
πŸ”₯2