 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.        Views: 6569

Attachments:

Replies to This Discussion

can anyone please tell me  if the user enters limit "0"

in that case the average is not correct

shouldn't we include that situation in the code as well?

or i just have to stick with the image limit of "5" ?

dear students some change,s in variable do not copy past

Attachments:

#include <iostream>
using namespace std;
main()
{
//Declaring Variables
int sum,avg,mininum,maxinum,mininumindx,maxinumindx,limit,limitinput;
sum = 0;
avg = 0;
mininum = 0;
maxinum = 0;
mininumindx = 0;

int i = 1;

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

limit = limitinput;

while(i<=limit)
{

switch(i){

case 1:
if(i<=limit)
{
cout"Enter "i "st value: ";
cin>>limitinput;
sum+=limitinput;

if(i==1)
{
mininum=limitinput;
maxinum=limitinput;
mininumindx=1;
maxinumindx=1;
}

if(mininum>limitinput)
{
mininum=limitinput;
mininumindx=i;
}

if(maxinum<limitinput)
{
maxinum=limitinput;
maxinumindx=i;
}
i++;
};
case 2:
if(i<=limit)
{
cout"Enter "i "nd value: ";
cin>>limitinput;
sum+=limitinput;

if(i==1)
{
mininum=limitinput;
maxinum=limitinput;
mininumindx=1;
maxinumindx=1;
}

if(mininum>limitinput)
{
mininum=limitinput;
mininumindx=i;
}

if(maxinum<limitinput)
{
maxinum=limitinput;
maxinumindx=i;
}
i++;
};
case 3:

if(i<=limit)
{
cout"Enter "i "rd value: ";
cin>>limitinput;
sum+=limitinput;

if(i==1)
{
mininum=limitinput;
maxinum=limitinput;
mininumindx=1;
maxinumindx=1;
}

if(mininum>limitinput)
{
mininum=limitinput;
mininumindx=i;
}

if(maxinum<limitinput)
{
maxinum=limitinput;
maxinumindx=i;
}
i++;
};
}

if(i<=limit)
{
cout"Enter "i "th value: ";
cin>>limitinput;
sum+=limitinput;

if(i==1)
{
mininum=limitinput;
maxinum=limitinput;
mininumindx=1;
maxinumindx=1;
}

if(mininum>limitinput)
{
mininum=limitinput;
mininumindx=i;
}

if(maxinum<limitinput)
{
maxinum=limitinput;
maxinumindx=i;
}
i++;
}
}

avg=sum/limit;
cout"\n\n";
cout"Sum of entered values = "sum"\n";
cout"Average values = "avg"\n";
cout"Minimum values = "mininum"\n";
cout"Minimum value entered at Index "mininumindx"\n";
cout"Maximum values = "maxinum"\n";
cout"Maximum values entered at Index "maxinumindx"\n";

system("pause");

}

Please Dear Students Must change the varialbe names and also Add some features in thi programme

#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 one is wrong :) actualy it's taking two variables as input :)

Friends here is solution of cs 201 assignment # 1 december 2015 (complete code working)

#include
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

do we have to submit zip folder containing both the snap shot n cpp file?

only .cpp file.

How many bytes will the pointer intPtr of type int move in the following statement?
intPtr += 3 ;

► 3 bytes

► 6 bytes

► 12 bytes

► 24 bytes

► 12 bytes