Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the double vector myValues with one element, the input integer newSize, and the input double startNum, resize myValues to newSize. Then, assign the new

Given the double vector myValues with one element, the input integer newSize, and the input double startNum, resize myValues to newSize. Then, assign the new elements of myValues with startNum -0.5* i, where i is the index of each element in the vector.
Ex: If the input is 313.5, then the output is:
39.513.012.5 #include
#include
#include
using namespace std;
int main(){
unsigned int i;
int initSize =1;
vector myValues(initSize);
int newSize;
double startNum;
myValues.at(0)=39.5;
cin >> newSize;
cin >> startNum;
for (int i =0; i < startNum.at(i); ++i){
startNum.at(i)= startNum.at(i)*-0.5;
}
for (i =0; i < myValues.size(); ++i){
cout << fixed << setprecision(1)<< myValues.at(i)<<"";
}
cout << endl;
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Theory And Applications 27th Australasian Database Conference Adc 20 Sydney Nsw September 28 29 20 Proceedings Lncs 9877

Authors: Muhammad Aamir Cheema ,Wenjie Zhang ,Lijun Chang

1st Edition

3319469215, 978-3319469218

More Books

Students also viewed these Databases questions

Question

c. Determine the confidence intervals of the linearised parameters.

Answered: 1 week ago