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
πŸš€ Unlock the Power of C++ with 'Programming with Faith'! πŸš€

Hey, future coding wizards! 🌟 Are you ready to dive into the world of programming? Join my premium channel, where we explore C++ together through engaging discussions!

πŸ’¬ Instead of just teaching, I want to hear from you! Share the topics you find challenging, and I’ll explain them one by one. This interactive method ensures that you grasp concepts fully and feel confident in your coding journey. πŸ’ͺ

πŸ‘‰ For Registration: [@ProgrammingWithFaith_bot]

@ProgrammingWithFaith2018
#CPlusPlus #ProgrammingWithFaith #LearnToCode
πŸ”₯2
βœ…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