Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THE PROVIDED QUESTION IS write a class to represent a vector (a series of float values). Include member functions to perform the following tasks: 1)To

THE PROVIDED QUESTION IS

write a class to represent a vector (a series of float values). Include member functions to perform the following tasks: 1)To Create the Vector 2)To modify the value of a given element 3)To multiply by a scalar value. 4)To display the vector in the form (10,20,30....) Write a program to test your class

SO ILL BE GIVING A CODE OF C++ .PLEASE EXLAIN ME THE CODE LINE BY LINE AND TELL ME THE ALGORITHM / FLOWCHART OF THE CODE . IT IS OF THE TOPIC VECTORS . IF THERE IS A SHORT ALERNATIVE CODE PROVIDE ME THE CODE .

// CODE BEGGINS

#include #include intconst size=50; class vector { float d[size]; int s; public: void create(void); void modify(void); void multiply(void); void display(void); }; void vector :: create(void) { cout<<" Enter of Array you want to create:-"; cin>>s; cout<<"Enter "<>d[i]; } void vector :: modify(void) { int mfy_value; float with; cout<<" Enter Location of array at which value is to be modified:-"; cin>>mfy_value; cout<<"Enter Value with which you want to Replace:-"; cin>>with; d[mfy_value]=with; } void vector :: multiply(void) { int mul; cout<<" Enter value with which you want to multiply:-"; cin>>mul; for(int i=0;i>choice; switch(choice) { case 1: o1.create(); break; case 2: o1.modify(); break; case 3: o1.multiply(); break; case 4: o1.display(); break; case 5:goto end; } }while(1); end: }

// CODE ENDS

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

More Books

Students also viewed these Databases questions

Question

4. What are the current trends in computer software platforms?

Answered: 1 week ago