write a program that will use a vector to store a set of decimal values .the size of the vector is up to you.A function should be called that will allow a user to enter the values for the vector.next you should display to the user the size of the victor ,how many element its hold .next another function should be called that will output the element of the vector(3 on each line with 5 spaces between).
1
Expert's answer
2012-11-15T07:39:12-0500
# include <iostream> # include <vector> using namespace std;
vector <double> A(20); void add(int i,double ch){// add a double A[i]=ch; } void out(int len){// print all int triple(0); while (len>=0){ & triple++; cout<<A[len]<<" quot;; if (triple%3==0) {triple=0; cout<<endl;} len--; } cout<<"End of vector"<<endl; } int main(){ double ch(1); int i(0); cin>>ch; while (ch!=0){ add(i,ch); i++; cin>>ch; } i--; out(i);
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment