MGT 317,HRM 326,GSP 125,CMGT 582,FIN 585,ACCT 505,CIS 517,CIS 517,BUS 661,ECET 365 , ,

UOP GSP 125 Week 3 iLab List of Numbers NEW

 

Check this A + tutorial guideline at

http://www.assignmentclick.com/gsp-125-devry/gsp-125-week-3-ilab-list-of-numbers-latest

 

For more classes visit

http://www.assignmentclick.com/

 

// lab3: listofnumbers
// <insert your name here & gt;
// read main.cpp, and follow the instructions at the bottom of main.cpp
#include & lt; iostream & gt;
using namespace std;
int main ()
{
int numberOfElements = 0;
float * elements = NULL;
float userInput;
bool addingNumbersToTheList;
cout & lt; & lt; "Keep entering numbers. Enter a non-number to stop. & Quot; & lt; & lt; endl;
do
{
cin & gt; & gt; user input;
addingNumbersToTheList =! std :: cin.fail ();
if (addingNumbersToTheList) {
// make a bigger array to replace the old one
float * biggerArray = new float [numberOfElements + 1];
if (elements!

// copy the old elements into the biggerArray
for (int i = 0; i <numberOfElements; i ++)
{
biggerArray [i] = elements [i];
}
// the old array is not needed anymore, we have a better copy
delete element;
}
// point at the new array
elements = biggerArray;
numberOfElements = numberOfElements + 1;
// put the new number into the last element of the array
element [numberOfElements-1] = userInput; }
}
while (addingNumbersToTheList); // fix cin after intentionally breaking it above.
if (std :: cin.fail ())
{
std :: cin.clear ();
while (std :: cin.get ()! = '\ n');
}
bool hasNumbers = numberOfElements & gt; 0;
if (hasNumbers) {
// print the stored numbers
cout <lt; "Entered numbers: & quot; & lt; & lt; endl;
cout & lt; & lt; & quot; {& quot ;;
for (int i = 0; i <numberOfElements; ++ i)
{
if (i> 0)
{
cout <lt; & quot ;, & quot ;;
}
cout & lt; & lt; elements [i]; }
cout & lt; & lt; & quot;} & quot; & lt; & lt; endl; }
else
{} float sum = 0;
for (int i = 0; i <numberOfElements; ++ i)
{

 

Diskussion