We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

Decision Structures
Question Description

Suppose you are required to write a C/C++ program for a bank in which all transactions of a day will be compared. Keep in mind a huge volume of transactions per day:

Your code should have following features:

  • The processing speed must be high.
  • The logic of the program must be simple.

Which decision structure (if-else and switch statement) would you choose to achieve above mentioned features of code, and also mention reasons in favor of your choice.

[Note: Answer must be comprehensive with logical reasoning. Confine your answer within 3 to 5 lines]

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 5682

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Replies to This Discussion

m also confused about that what type of transaction would be compared 

I asked Teacher about it and here is her reply:

Dear Student,
First of all, in GDB coding is not required. You have to select a decision structure according to the given scenario and have to provide the reasons. Then login the VULMS, click on GDB icon and post your comments.
Transaction examples are:
a user deposit cash in his/her account.
A user withdraws some cash from his/her account.
A user checks the balance of his/her account etc.
Regards,

Instructor CS201
Department of Computer Sciences
VU, Pakistan

Dont Be Confused Keep Keen Attention on Question :) 

This is your gdb solution: 

Switch statement is much faster than if-else due to the following reasons:

Switch statement is better because

1) compiler generates a jump table during compilation.

2) instead of checking which case is true, it only moves to that case which has to be executed.

3) It is more readable.

4) It is more manageable regarding above scenario.

Regards (Sir G)

agreed

CS201 GDB solution

In my opinion, switch statements id better than If-Else. Switch statements have its best uses then there are more environments. As we know that if statements checks for all the conditions and then when the condition is matched then the following body inside it is executed but this is not the case with switch condition as it directly checks for the compatible conditions and executes the code.

The reason behind the selection of switch statement is;

Working speed of switch statement is much faster than if-else.
The reason is that compiler produces a jump table for a switch in the course of assembling. Thus, during accomplishment, as a substitute of testing which case is contented, it only picks which case has to be accomplished.

It is more understandable and in parallel to if-else testimonials.

Switch statement is more manageable for taking higher level of transactions than if-else

GDB ki zara samj ni a rahi koi help kar day.

dear koi to solution file bhej do aj last date he..

if else or switch

confirm batao

CS201 GDB Solution 

Solved GDB CS201 

According to features of the c/c++ language, switch statement is much faster than simple if-else statement. We know that switch statement uses the cases for switching. So it is more compact for the compiler, so it generate the jump table. This jump table is fix not change. It is also called multiway branch or branch table. So in my opinion switch is the best choice in this scenario. Because of speed, compactness and cases. Switch statement allow the value of a variable or expression to change the control flow of program execution via a multiway branch.

RSS

Latest Activity

+ ! ! ! ! ! ! ! ! ! AG liked UMER UMER's discussion online earing
5 minutes ago
+ ! ! ! ! ! ! ! ! ! AG liked +¢αяєℓєѕѕ gιяℓ's discussion چاۓ
5 minutes ago
+ ! ! ! ! ! ! ! ! ! AG liked UMER UMER's discussion Modern Era and Our Obligations on Our Loved Ones
5 minutes ago
+ ! ! ! ! ! ! ! ! ! AG liked Muhammad Ishtiaq's discussion Past Papers
5 minutes ago
+ ! ! ! ! ! ! ! ! ! AG liked Syeda's discussion MTH601 - Operations Research solved....
5 minutes ago
+ ! ! ! ! ! ! ! ! ! AG liked ٢ دن's discussion زندگی گزارنے کا فارمولا
5 minutes ago
+ ! ! ! ! ! ! ! ! ! AG liked Muhammad Ishtiaq's discussion Assignment
5 minutes ago
+ ! ! ! ! ! ! ! ! ! AG liked + ! ! ! ! ! ! ! ! ! ! ! ! ! ! !'s discussion رشتوں میں بیلنس قائم کریں
5 minutes ago
+ ! ! ! ! ! ! ! ! ! AG liked Waseem Khan's discussion CS510 Assignmnet 1 Solution
5 minutes ago
+ ! ! ! ! ! ! ! ! ! AG liked Waseem Khan's discussion CS619 Final project Help
5 minutes ago
+ ՏhehαrZααD + posted a discussion
17 minutes ago
◄ Zohaib ► replied to + M.Tariq Malik's discussion PAK301 Assignment No 01 Fall 2019 Solution & Discussion Due Date: 21-11-2019 in the group PAK301 Pakistan Studies
20 minutes ago
◄ Zohaib ► joined + M.Tariq Malik's group
20 minutes ago
Ahmer Rajpoot posted a discussion
31 minutes ago
Awais Ahmad liked ALEENA's profile
43 minutes ago
Fazal ur Rehman replied to + M.Tariq Malik's discussion SOC101 Assignment No 01 Fall 2019 Solution & Discussion Due Date: 21-11-2019 in the group SOC101 Introduction to Sociology
1 hour ago
Fazal ur Rehman joined + M.Tariq Malik's group
1 hour ago
Khuzamah Rasheed replied to + M.Tariq Malik's discussion EDU402 Curriculum Development Assignment No 01 Fall 2019 Solution & Discussion in the group EDU402 Curriculum Development
1 hour ago
Khuzamah Rasheed joined + M.Tariq Malik's group
1 hour ago
ALEENA and Adilshahid are now friends
1 hour ago

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service