php hit counter

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CS201-Introduction to Programming Assignement No.1 Due Date 14th May 2014
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#1

CS201-Introduction to Programming Assignement No.1 Solutions

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

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.


Reply
#2


#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
cout "Please enter the option <e, E or o, O>:";
char option=0;
cin >> option;
switch(option)
{
case 'e':
case 'E':
cout"\n";
cout "Even number 1 to 50" endl "\n";
for(int i=1; i<=50; i++)
{
if(i%2==0)
{
cout i ",";
}
}
break;

case 'o':
case 'O':
cout"\n";
cout "Odd Number 1 to 50" endl "\n";
for(int i=1; i<=50; i++ )
{
if(i%2==1)
{
cout i ", ";
}
}
break;
default:
cout"\n";
cout "your choice is Wrong please Enter [e,E,o,O]";
}

cout"\n";
coutendl;

system("PAUSE");
return EXIT_SUCCESS;
}


#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
cout "Please enter the option <e, E or o, O>:";
char option=0;
cin >> option;
switch(option)
{
case 'e':
case 'E':
cout"\n";
cout "Even number 1 to 50" endl "\n";
for(int i=1; i<=50; i++)
{
if(i%2==0)
{
cout i ",";
}
}
break;

case 'o':
case 'O':
cout"\n";
cout "Odd Number 1 to 50" endl "\n";
for(int i=1; i<=50; i++ )
{
if(i%2==1)
{
cout i ", ";
}
}
break;
default:
cout"\n";
cout "your choice is Wrong please Enter [e,E,o,O]";
}

cout"\n";
coutendl;

system("PAUSE");
return EXIT_SUCCESS;
}

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply
#3
there are two ways to stop the output
1. last statement in the main program should be
system("pasue");
2. last statement should be:
getch();
for the 2nd step you need to add one header file conio.h
in the beginning write #include<conio.h>
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  CS201 Assignment vo 3 Solution 20th January 2016 Vuhelper 2 2,650 01-20-2016, 03:28 PM
Last Post: Vuhelper
  SOC101 INTRODUCTION TO SOCIOLOGY assignment no 3 Solution 20 January 2016 Vuhelper 0 1,907 01-20-2016, 03:19 PM
Last Post: Vuhelper
  Assignment solution eng 301 due date 20 may 2015 rumesa khan 3 4,577 05-20-2015, 01:34 AM
Last Post: Xpert
  vu eng301 first assignment spring 2015 due date 22 may Xpert 0 2,851 05-15-2015, 03:34 AM
Last Post: Xpert
  Bus Ticket Reservation System SRS CS619 Final Software Project Semester Fall 2014 Vuhelper 6 5,192 01-13-2015, 04:46 AM
Last Post: Xpert
  CS710 Mobile and Pervasive Computing Assignment No. 2 Fall 2014 Vuhelper 0 2,647 12-23-2014, 02:41 PM
Last Post: Vuhelper
  MTH301 - Calculus II Assignment No. 02 Solution and Discussion Fall 2014 Vuhelper 0 2,824 12-17-2014, 09:34 PM
Last Post: Vuhelper
  CS601 Assignment No. 2 Close Date is 15th December 2014 Vuhelper 3 3,688 12-15-2014, 09:53 PM
Last Post: Vuhelper
  ENG201 Business & Technical English Assignment No. 02 Due Date Dec 15, 2014 education-2014 2 3,347 12-15-2014, 08:30 PM
Last Post: Vuhelper
  IT430 - E-Commerce Assignments No. 2 Solution and Discussion Close Date Dec 15, 2014 Entboy 2 2,847 12-15-2014, 04:29 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support