www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# CS201 Introduction to Programming Assignment No 02 Spring 2019 Solution & Discussion Due Date: 29-05-2019

CS201 Introduction to Programming Assignment No 02 Spring 2019 Solution & Discussion Due Date: 29-05-2019

Views: 2342

### Replies to This Discussion

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. Read More>>

Discussed & be touched with this discussion. After discussion a perfect solution will come in a result at the end.

“How to Join Subject Study Groups & Get Helping Material”

P.S:    Please always try to add the discussion in proper format title like “CS101 Assignment / GDB No 01 Solution & Discussion Due Date: ___________”

Share below link with friends for solution & Discussion. A Single link for help in your education.

http://bit.ly/vucodes

CS201 Assignment#02 Question File

Attachments:

CS201 Assignment No 2 Solution - Spring 2019

Write a menu based system in C++ that will take input from user for the following menu. You will create an array. And perform the following operations on the array.

Press 1 To Enter Values In Array.

Press 2 To Read Array Elements.

Press 3 To Show Array Elements In Reverse Order.

Press 4 To Show Array Elements Which Are Multiples Of 3.

Press 5 To Show Sum Of All The Elements.

Press 6 To Exit.

Solution Instructions:

è Use switch statement for the menu based system.

èYou have to use pointers for option 2, 3, 4, 5.

èYou can use user defined functions for each of the task mentioned above to manage your code.

 To Enter Values In Array getValues(); To Read Array Elements displayArray(); To Show Array Elements In Reverse Order reverseArray(); To Show Array Elements Which Are Multiples Of 3. multipleOf3(); To Show Sum Of All The Elements sumOfElements();

If the user chooses any option other than 1, for the first time, when array is empty, so the user will get a message

Array is empty, first enter data in arrayas shown in the sample output.

Where is code????

CS201 Assignment No 02 Solution Spring 2019

Attachments:
100% correct Assignment 2 solution of cs201 spring2019

CS201-Assignment-No-2-Solution

Attachments:

Cs201 Assignment Solution
Please is ko Compile kr k check kr ly
#include <iostream>
using namespace std;
#include <stdlib.h>
int array[5];
int count=0;
int getvalues()
{
int i;

cout"Enter Data In Array\n\n";
for( i=0; i<5; i++)
{
cout"Enter Value:";
cin>>array[i];
count++;
}
couti" elements entered\n";
}
void displayArray()
{
cout"Now All The element of the Array is : \n";
for(int i=0; i<5; i++)
{
coutarray[i]'\n';
}
}
void multipleOf3()
{
cout"Now the Multiplye Each Element by 3 Array is : \n";
for(int i=0; i<5; i++)
{
coutarray[i]*3'\n';
}
}
void sumOfElements()
{
cout"Show The Sum Of All the elements \n";
int sum=0;
for(int i=0; i<5; i++)
{

sum=array[i]+sum;

}
coutsum'\n';
}
void reverseArray()
{
int i, j, temp;

for (int i = 0; i < (5 / 2); i++) {

int temporary = array[i];
array[i] = array[(5 - 1) - i];
array[(5 - 1) - i] = temporary;

}
cout"Now the Reverse of the Array is : \n";
for(i=0; i<5; i++)
{
coutarray[i]" "'\n';
}
}

main()
{
int choice;
char b;
do{

cout"Press 1 To Enter Data In Array\n";
cout"Press 2 To Read Array Elements.\n";
cout"Press 3 To Show Array Elements In Reverse Order.\n";
cout"Press 4 To Show Array Elements Which Are Multiples Of 3.\n";
cout"Press 5 To Show Sum Of All The Elements.\n";
cout"Press 6 To Exit\n";
cin>>choice;
switch(choice)
{
case 1:
getvalues();
break;
case 2:

if(count==0)
{
cout"Array is empty, first enter data in array\n";
}else
{

displayArray();
}
break;
case 3:
if(count==0)
{
cout"Array is empty, first enter data in array\n";
}else
{
reverseArray();
}
break;
case 4:
if(count==0)
{
cout"Array is empty, first enter data in array\n";
}else
{
multipleOf3();
}
break;
case 5:
if(count==0)
{
cout"Array is empty, first enter data in array\n";
}else
{
sumOfElements();
}
break;
case 6:
exit(0);

}
cout"Do you want to continue ? Press Y/y for yes : ";
cin>>b;
}while(b=='y' || b=='Y');
return 0;
}

yeh pointer k sath solve nahi ki hoi. pointer k sath solve krni thi .

How i use this programme?

cs201-assignment-no-2

Attachments:

1

2

3

4

5

## VIP Member Badge & Others

------------------------------------