C++ Basic 2018 (Batch-2)
π 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β¦
π Special discount for those who invite others to join the premium channel! π For details, DM @TechnerdGuy π©
β€1π1
β€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
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
ββ 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
C++ Basic 2018 (Batch-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β¦
To register for the premium class, π [@ProgrammingWithFaith_bot] π
π₯2
β Exercise: Increment and Decrement
1. int a=5;@ProgrammingWithFaith2018
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;
β€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 ]
β For registration:[ @ProgrammingWithFaith_bot ]
β€1
π² Quiz 'C++ Chapter One'
π 16 questions Β· β± 1 min
π 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 ]
link: [ https://sma.robi.work/b/bqkJIHVlXiTl ]
sma.robi.work
Send Messages Anon
A web based ngl.link alternative ask me anything platform.
β€1π1
https://movie-review-app-pi-two.vercel.app/
For more , you can join my personal channel where I share what I do. @SelfTaughtDev1
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
https://t.me/InsideAds_bot/open?startapp=r_1876122021
π₯2