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.

# Assignment cs201 Idea slution

Views: 6554

Attachments:

### Replies to This Discussion

#include <iostream>
using namespace std;
main ()
{
int limit=0;
int number=0;
int sum=0;
int min=0;
int max=0;
int minIndex=0;
int maxIndex=0;
int average=0;

cout"Please enter the loop limit: ";
cin>>limit;
cout"\n\n";

for (int x=1; x<=limit; x++)
{
cout"Please enter " x" value: ";
cin>>number;
sum = sum+number;

if(x==1)
{
min=number;
max=number;
}
if (min>number)
{
min=number;
minIndex=x;
}
if(max<number)
{
max=number;
maxIndex=x;
}
}
average= sum/limit;
cout"\n\n";
cout"Sum of Entered Values = "sumendl;
cout"Average of the Entered Values = "averageendl;
cout"Minimum Entered Value = "minendl;
cout"Minimum Value Entered at Index = "minIndexendl;
cout"Maximum Entered Value = "maxendl;
cout"Maximum Entered Value at Index = "maxIndex;

}

this is just idea to how to find a smaller number in data. so u will be able to use the core code in your assignment, take idea and make your assignment.
Note:its not solution. contents of codes can be used to make assignment but dont upload as assignment as it can cause deduction of numbers.

#include <iostream.h>

main()
{
int RCV=0;
int Carry[10];
int size=0;
int Indexcount=0;
//to get the number of loops time form user

cout"Enter loop limit:";
cin>>size;
//get the values for use to save in an array
for(int c = 0;c < size;++c){
if(c==0){
cout"Enter the 1st value";
cin>>RCV;
Carry[0]=RCV;};
if(c==1){
cout"\n Enter the 2nd value";
cin>>RCV;
Carry[1]=RCV;};
if(c==2){
cout"\n Enter the 3rd value";
cin>>RCV;
Carry[2]=RCV;};
if(c==3){
cout"\n Enter the 4th value";
cin>>RCV;
Carry[3]=RCV;};
if(c==4){
cout"\n Enter the 5th value";
cin>>RCV;
Carry[4]=RCV;};};
int min;
min=Carry[0];
for(int b=1;b<size;++b)
{
if(Carry[b]<min)
{
min=Carry[b];
Indexcount=b;
//coutminendl;
//coutIndexcountendl;
};};
cout"Minimum vlue is :"minendl;
cout"Index of the value is "Indexcountendl;

// comparision we will with the first value to find minimum value.
system("pause");
}

//ASSIGNMENT SOLUTION BY JERRY

#include <iostream>
using namespace std;
main()
{

int Sum=0;
int Average=0;
int Limit=0;
int minival=0;
int maxival=0;
int minivalIndex=0;
int maxivalIndex=0;
int limit2 = 0;
int i = 1;

cout"Enter Loop limit: ";
cin>>Limit;
cout"\n\n";

limit2 = Limit;

while(i<=limit2)
{

cout"Enter "i "value: ";
cin>>Limit;
Sum=Sum+Limit;

if(i==1)
{
minival=Limit;
maxival=Limit;
minivalIndex=1;
maxivalIndex=1;
}

if(minival>Limit)
{
minival=Limit;
minivalIndex=i;
}

if(maxival<Limit)
{
maxival=Limit;
maxivalIndex=i;
}

i++;
}

Average=Sum/limit2;
cout"\n\n";
cout"Sum of entered values = "Sumendl;
cout"Average values = "Averageendl;
cout"Minimum values = "minivalendl;
cout"Minimum value entered at Index "minivalIndexendl;
cout"Maximum values = "maxivalendl;
cout"Maximum values entered at Index "maxivalIndexendl;

system("pause");

}

Assignment Submission Instructions

You have to submit only.cpp file on the Assignments interface of CS201 at VULMS. Assignment submitted in any other format will not be accepted and will be graded zero marks.

#include <iostream>
using namespace std;
main ()
{
int limit=0;
int number=0;
int sum=0;
int min=0;
int max=0;
int minIndex=0;
int maxIndex=0;
int average=0;

cout"Please enter the loop limit: ";
cin>>limit;
cout"\n\n";

for (int x=1; x<=limit; x++)
{
cout"Please enter " x" value: ";
cin>>number;
sum = sum+number;

if(x==1)
{
min=number;
max=number;
}
if (min>number)
{
min=number;
minIndex=x;
}
if(max<number)
{
max=number;
maxIndex=x;
}
}
average= sum/limit;
cout"\n\n";
cout"Sum of Entered Values = "sumendl;
cout"Average of the Entered Values = "averageendl;
cout"Minimum Entered Value = "minendl;
cout"Minimum Value Entered at Index = "minIndexendl;
cout"Maximum Entered Value = "maxendl;
cout"Maximum Entered Value at Index = "maxIndex;

}

#include<iostream>
using namespace std;
void process(int);
int main()
{
int loopLimit = 0;

cout"Enter loop limit : ";
cin>>loopLimit;

process(loopLimit);

coutendl;

}
void process(int x)
{
int input = 0;
int sum = 0;
int minValue = 0;
int minIndex = 0;
int maxValue = 0;
int maxIndex = 0;

for(int i = 0 ; i<x;i++){

cout"Enger Value "i+1" : ";
cin>>input;
if(i==0)
{
minValue = input;
maxValue = input;
minIndex = i+1;
}

if( input < minValue)
{
minValue = input;
minIndex = i+1;
}

else if( input > maxValue)
{
maxValue = input;
maxIndex = i+1;
}
sum = sum + input;

}

cout"Sum of Entered Values : "sumendl;
cout"Average Values : "sum/5endl;
cout"Minimum Value : "minValueendl;
cout"Minimum Value entered at index at : "minIndexendl;
cout"Maximum Value : "maxValueendl;
cout"Maximum Value entered at index at : "maxIndexendl;

}

#include <iostream>
using namespace std;
main()
{

int Sum=0;
int Average=0;
int Limit=0;
int minival=0;
int maxival=0;
int minivalIndex=0;
int maxivalIndex=0;
int limit2 = 0;
int i = 1;

cout"Enter Loop limit: ";
cin>>Limit;
cout"\n\n";

limit2 = Limit;

while(i<=limit2)
{

cout"Enter "i "value: ";
cin>>Limit;
Sum=Sum+Limit;

if(i==1)
{
minival=Limit;
maxival=Limit;
minivalIndex=1;
maxivalIndex=1;
}

if(minival>Limit)
{
minival=Limit;
minivalIndex=i;
}

if(maxival<Limit)
{
maxival=Limit;
maxivalIndex=i;
}

i++;
}

Average=Sum/limit2;
cout"\n\n";
cout"Sum of entered values = "Sumendl;
cout"Average values = "Averageendl;
cout"Minimum values = "minivalendl;
cout"Minimum value entered at Index "minivalIndexendl;
cout"Maximum values = "maxivalendl;
cout"Maximum values entered at Index "maxivalIndexendl;

system("pause");

}

ye ly g

Attachments:

This is complete solved file for all :) .. Please must change its variable names and add some comments ..

in this I added  1st , 2nd ,3rd and 4th features .. which follows the screen of the assignment programme .

Attachments:

Attachments:

complete n verified solution....avg=22 problem is solved by using ceil function.... copy code from here or just download .cpp ... thnx all sis n bro :)

#include <iostream>
#include <math.h>
using namespace std;

int main()
{
int minIndex = 1, maxIndex = 1, values, min = 0, max = 0 ;
double average, sum, loop;
cout "Enter Loop limit: ";
cin>>loop;
cout endl;
for(int i=1; i<=loop; i++)
{
if(i==1)
{
cout"Enter 1st value; ";
}
else if(i==2)
{
cout"Enter 2nd value; ";
}
else if(i==3)
{
cout"Enter 3rd value; ";
}
else if(i<=loop)
{
cout"Enter " i "th value; ";
}
cin>> values;
sum +=values;
average = ceil(sum/loop);
if (i==1)
{
min = values;
max = values;
minIndex = 1;
maxIndex = 1;
}
if (min > values)
{
min = values;
minIndex = i;

}
if (max < values)
{
max = values;
maxIndex = i;
}
}
cout endl endl;
cout "Sum of Entered Values = " sum endl;
cout "Average Values = " average endl;
cout "Minimum Values = " min endl;
cout "Minimum Value Entered at Index " minIndex endl;
cout "Maximum Values = " max endl;
cout "Maximum Value Entered at Index " maxIndex endl;
system("PAUSE");

}

Attachments:

1

2

3

## Latest Activity

+ ! zεε liked иαвєєℓ αнмє∂'s discussion CS619 Project Students
4 hours ago
Hamid left a comment for jiya ali
5 hours ago
Hamid and jiya ali are now friends
5 hours ago
Usama shahid joined + M.Tariq Malik's group

12 hours ago

### Losers

13 hours ago
sria aslam, Khawir Abbas and Sana Shafaq joined Virtual University of Pakistan
16 hours ago
+ ♥ Haniya Khan posted a photo

### Losers

yesterday
Abdul Rehman updated their profile
Saturday