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.

Instructions:

Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:

 

  • The assignment is submitted after due date.
  • The submitted assignment does not open or file is corrupt.
  • Assignment is copied(partial or full) from any source (websites, forums, students, etc)

 

Note: You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted and will be awarded with zero marks. For example, if you submit code in .doc (Word document) or .txt files or .exe file, no reward will be given in any case.

 

Objective:

 

The objective of this assignment is to provide hands on experience of:

 

  • Basic concepts of C/C++ language and Programming
  • Dealing with Data types
  • Conditional statements of C/C++ language
  • Repetition Structures (Loop)
  • Switch statement

 

 

Guidelines:

 

  • Code should be properly indented and well commented.
  • Follow C/C++ rules while writing variable names, function names etc
  • Use only dev-C++ for this assignment.

Assignment:

Problem Statement:     

 

You are required to write a C++ program using loop and switch statement. The program should display even or odd numbers from 1 to 50 depending upon the option given by the user.

 

 

Detailed Description:

 

The program should prompt the user for one character option (either ‘e’, ‘E’ or ‘o’, ‘O’).   

 

It should respond in the following ways:

  • If user enters character option ‘e’ or ‘E’ then it should display the even numbers from 1 to 50.
  • If user enters character option ‘o’ or ‘O’ then it should display the odd numbers from 1 to 50.

 

Sample output of the program:

If user enters ‘e’ then it displays the even numbers from 1 to 50. 

If user enters ‘E’ then it displays the even numbers from 1 to 50. 

If user enters ‘o’ then it displays the odd numbers from 1 to 50. 

If user enters ‘O’ then it displays the odd numbers from 1 to 50. 

+ 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: 5229

.

+ 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)

Attachments:

Replies to This Discussion

good job

@Ahmad Prince, Thanks Dear Brother 

Ahmad bahi ye to run ni ho rha...E or e write kr k enter press karyn to screen hi disappear ho jati h

plzz help me

@Lucky, check attachment "Assignment No1_CS201_Solved.cpp" file. it will fixed your issue.

#include <iostream>

using namespace std;

int main () {

char character;

cout "Please enter the option <e, E or o, O>: ";

cin >> character;

int digit = 1;

switch ( character ) {
case 'e':

cout "Even numbers from 1 to 50 " endl;
while (digit <= 50) {

if ( digit % 2 == 0 ) {
cout digit ", ";
}

digit++;
}

break;

case 'E' :

cout "Even numbers from 1 to 50 " endl;
while (digit <= 50) {

if ( digit % 2 == 0 ) {
cout digit ", ";
}

digit++;
}

break;

case 'o' :

cout "Odd numbers from 1 to 50 " endl;
while (digit <= 50) {

if ( digit % 2 == 1 ) {
cout digit ", ";
}

digit++;
}
break;

case 'O' :

cout "Odd numbers from 1 to 50 " endl;
while (digit <= 50) {

if ( digit % 2 == 1 ) {
cout digit ", ";
}

digit++;
}

break;
}

}

Note: For original code, download ".txt" file attachment. All answers are just contribution for helping other students, Please don't copy and paste it, Just try to understand major concepts. Best of luck...

Attachments:

really nice attempt by you

Ahmad

Bro! one way is to create functions for both even and odd numbers and just call them

in o or O and e or E cases respectively.

Please Discuss here about this assignment.Thanks

Our main purpose here discussion not just Solution

We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions.

u r right M.Tariq

Ahmad gud..keep it up 

can doc.comand compulsory

H@A M.I.T student wat do u men by doc.comand?

RSS

Latest Activity

Repanzal added a discussion to the group CS615 Software Project Management
1 hour ago
Repanzal joined +M.Tariq Malik's group
1 hour ago
Repanzal posted a status
"CS615 GDB solution plzz..."
1 hour ago
Munna Bhai MBBS posted discussions
1 hour ago
maheen mahan posted a discussion
3 hours ago
Awais replied to Awais's discussion دل کے دشمن کو مہمان کر رکھا ھے
4 hours ago
Awais replied to Awais's discussion دل کے دشمن کو مہمان کر رکھا ھے
4 hours ago
Mani Siddiqui BS VIII posted a status
"میرا بہت دل چاہتا ہے کہ اک پل کے لیے سہی میں ہر رات سونے سے پہلے تمھاری آواز سنوں ♥ #Mani"
5 hours ago
Mani Siddiqui BS VIII posted a status
"سرد لہجوں کے برف زاروں پر . . . . منجمند ھیں تمام تر سوچیں!"
5 hours ago
Mani Siddiqui BS VIII posted a discussion
5 hours ago
Profile IconSilent Boy, Sofia_Khan, Sheikhhaleema and 1 more joined Virtual University of Pakistan
5 hours ago
Mani Siddiqui BS VIII posted a status
"کبھی جو یاد آؤں اُداسی میں پُرانے میسج پڑھ لینا میرے پاس بھی بس یہی سہولت ہے"
6 hours ago

Today Top Members 

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

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

.