Question Solved1 Answer this is in c++ and in codeblocks, i have no idea how or where to start with this, please explain in the best way possible and show me what you did. also pictures of the outputs would be nice:) thank you!! Task Description: You have been given a very simple program that performs basic operations (addition, subtraction, editing) on two randomly generated integer vectors. All functionality has been included in main, causing code segments to be repeated as well as diminishing the readability Rewrite the program by grouping calculations and related operations into functions. In particular, your program should include the following functions • InitializeVectors: This is a void function that initializes the two vectors by random numbers. Inside this function, the user will be prompted to enter the maximum random number. After the vectors have been populated with random numbers, print the vectors side by side. The parameters are the two arrays and their size. • EditVector. This is a void function that allows the user to update a value belonging to either vector. The user specifies the vector he wants to edit, the index he wants edit, and finally the updated value. The entire vector must then be printed on the screen. You need to pass the two arrays and their sizes • Calculate Average: This is a function that returns the average value in a vector It returns a double and receives as parameters an array and its size • print Vector: A void function that takes a vector as a parameter along with its size and prints it on the screen As you introduce each function, replace the code in main( by the appropriate function call. Also, keep in mind that for some functions, any changes that occur within the function body must also be visible in main. Finally, some functions can be called within other functions. OS . GOODS Start here X main(33). #include chitalardo.h> ing pasta int main() 9 10 11 12 13 14 Tnt voor the into the root both hando o int id Wenn which to have int ceiling Werting randon numbers to pisce in to this contra int action of the per double av GetSize: coot Entiteto vectors dinsv_ite: Icin.Biltre 20 21 22 ayate (Hot cout<>Vid: i lain. fail trued_102) > Start here X als ! main(33).cpp X if (cin. fail() - true 1 ( vid! 1. Vid!-2)) 1 system("CLS"); cout<<"Invalid Input. Please Re-enter Vector Selection (1 OF 2): "; cin.clear(): cin. ignore (10000,"\n'); goto get Vector: 1 11 (101) for (int 10; i>v id; if (cin.fail() == true 1 (v_id ! v_id !=2) system("CLS"); cout<<"Invalid Input. Please Re-enter Vector Selection (1 or 2): ": Search Project Build Debug Fortran wxSmith Tools Tools Plugins DoxyBlocks Settings Help 499: 96: Il FSymbols main(33).cpp x cout<<"Invalid Input. Please Re-enter Vector Selection (1 or 2): cin.clear() cin.ignore (10000,"\n"); goto Get Vector: > Get Index: cout<<"Select Index to be Updated: "<>index: if(win. failt) - true index || index) (v size-1)) Start here X 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 system("CUS"): cout<<"Invalid Input. Please Re-enter index to be updated: ": cin.clear(); cin.ignore (10000, An): goto Get Index: > cout<<"Enter updated value: if(v_id = 1) -n cin>5v1 [index: for (int i=0; i< v Bize 1 cout<>v2 [index] for (int i=0; i v_size: 1) cout<>vl[index] : for (int i0; i< v_size; i++) cout<>v2 [index); for (int 10; 1Vsize: 1++) cout<

PTJL14 The Asker · Computer Science
this is in c++ and in codeblocks, i have no idea how or where to start with this, please explain in the best way possible and show me what you did. also pictures of the outputs would be nice:) thank you!!
Transcribed Image Text: Task Description: You have been given a very simple program that performs basic operations (addition, subtraction, editing) on two randomly generated integer vectors. All functionality has been included in main, causing code segments to be repeated as well as diminishing the readability Rewrite the program by grouping calculations and related operations into functions. In particular, your program should include the following functions • InitializeVectors: This is a void function that initializes the two vectors by random numbers. Inside this function, the user will be prompted to enter the maximum random number. After the vectors have been populated with random numbers, print the vectors side by side. The parameters are the two arrays and their size. • EditVector. This is a void function that allows the user to update a value belonging to either vector. The user specifies the vector he wants to edit, the index he wants edit, and finally the updated value. The entire vector must then be printed on the screen. You need to pass the two arrays and their sizes • Calculate Average: This is a function that returns the average value in a vector It returns a double and receives as parameters an array and its size • print Vector: A void function that takes a vector as a parameter along with its size and prints it on the screen As you introduce each function, replace the code in main( by the appropriate function call. Also, keep in mind that for some functions, any changes that occur within the function body must also be visible in main. Finally, some functions can be called within other functions. OS . GOODS Start here X main(33). #include chitalardo.h> ing pasta int main() 9 10 11 12 13 14 Tnt voor the into the root both hando o int id Wenn which to have int ceiling Werting randon numbers to pisce in to this contra int action of the per double av GetSize: coot Entiteto vectors dinsv_ite: Icin.Biltre 20 21 22 ayate (Hot cout<>Vid: i lain. fail trued_102) > Start here X als ! main(33).cpp X if (cin. fail() - true 1 ( vid! 1. Vid!-2)) 1 system("CLS"); cout<<"Invalid Input. Please Re-enter Vector Selection (1 OF 2): "; cin.clear(): cin. ignore (10000,"\n'); goto get Vector: 1 11 (101) for (int 10; i>v id; if (cin.fail() == true 1 (v_id ! v_id !=2) system("CLS"); cout<<"Invalid Input. Please Re-enter Vector Selection (1 or 2): ": Search Project Build Debug Fortran wxSmith Tools Tools Plugins DoxyBlocks Settings Help 499: 96: Il FSymbols main(33).cpp x cout<<"Invalid Input. Please Re-enter Vector Selection (1 or 2): cin.clear() cin.ignore (10000,"\n"); goto Get Vector: > Get Index: cout<<"Select Index to be Updated: "<>index: if(win. failt) - true index || index) (v size-1)) Start here X 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 system("CUS"): cout<<"Invalid Input. Please Re-enter index to be updated: ": cin.clear(); cin.ignore (10000, An): goto Get Index: > cout<<"Enter updated value: if(v_id = 1) -n cin>5v1 [index: for (int i=0; i< v Bize 1 cout<>v2 [index] for (int i=0; i v_size: 1) cout<>vl[index] : for (int i0; i< v_size; i++) cout<>v2 [index); for (int 10; 1Vsize: 1++) cout<
More
Transcribed Image Text: Task Description: You have been given a very simple program that performs basic operations (addition, subtraction, editing) on two randomly generated integer vectors. All functionality has been included in main, causing code segments to be repeated as well as diminishing the readability Rewrite the program by grouping calculations and related operations into functions. In particular, your program should include the following functions • InitializeVectors: This is a void function that initializes the two vectors by random numbers. Inside this function, the user will be prompted to enter the maximum random number. After the vectors have been populated with random numbers, print the vectors side by side. The parameters are the two arrays and their size. • EditVector. This is a void function that allows the user to update a value belonging to either vector. The user specifies the vector he wants to edit, the index he wants edit, and finally the updated value. The entire vector must then be printed on the screen. You need to pass the two arrays and their sizes • Calculate Average: This is a function that returns the average value in a vector It returns a double and receives as parameters an array and its size • print Vector: A void function that takes a vector as a parameter along with its size and prints it on the screen As you introduce each function, replace the code in main( by the appropriate function call. Also, keep in mind that for some functions, any changes that occur within the function body must also be visible in main. Finally, some functions can be called within other functions. OS . GOODS Start here X main(33). #include chitalardo.h> ing pasta int main() 9 10 11 12 13 14 Tnt voor the into the root both hando o int id Wenn which to have int ceiling Werting randon numbers to pisce in to this contra int action of the per double av GetSize: coot Entiteto vectors dinsv_ite: Icin.Biltre 20 21 22 ayate (Hot cout<>Vid: i lain. fail trued_102) > Start here X als ! main(33).cpp X if (cin. fail() - true 1 ( vid! 1. Vid!-2)) 1 system("CLS"); cout<<"Invalid Input. Please Re-enter Vector Selection (1 OF 2): "; cin.clear(): cin. ignore (10000,"\n'); goto get Vector: 1 11 (101) for (int 10; i>v id; if (cin.fail() == true 1 (v_id ! v_id !=2) system("CLS"); cout<<"Invalid Input. Please Re-enter Vector Selection (1 or 2): ": Search Project Build Debug Fortran wxSmith Tools Tools Plugins DoxyBlocks Settings Help 499: 96: Il FSymbols main(33).cpp x cout<<"Invalid Input. Please Re-enter Vector Selection (1 or 2): cin.clear() cin.ignore (10000,"\n"); goto Get Vector: > Get Index: cout<<"Select Index to be Updated: "<>index: if(win. failt) - true index || index) (v size-1)) Start here X 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 system("CUS"): cout<<"Invalid Input. Please Re-enter index to be updated: ": cin.clear(); cin.ignore (10000, An): goto Get Index: > cout<<"Enter updated value: if(v_id = 1) -n cin>5v1 [index: for (int i=0; i< v Bize 1 cout<>v2 [index] for (int i=0; i v_size: 1) cout<>vl[index] : for (int i0; i< v_size; i++) cout<>v2 [index); for (int 10; 1Vsize: 1++) cout<
See Answer
Add Answer +20 Points
Community Answer
OZWWCK The First Answerer
See all the answers with 1 Unlock
Get 4 Free Unlocks by registration

General GuidanceThe answer provided below has been developed in a clear step by step manner.Step: 1.lcWjel{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;font-size:0.75rem;box-sizing:border-box;}/*!sc*/ data-styled.g366[id="sc-mwpquf-0"]{content:"lcWjel,"}/*!sc*/ .loOCZZ{margin:0;font-family:"Aspira Webfont","Helvetica","Arial",sans-serif;}/*!sc*/ .loOCZZ .align-left{text-align:left;}/*!sc*/ .loOCZZ .align-center{text-align:center;}/*!sc*/ .loOCZZ .align-right{text-align:right;}/*!sc*/ data-styled.g367[id="sc-mwpquf-1"]{content:"loOCZZ,"}/*!sc*/ .cpESDm .DraftEditor-editorContainer,.cpESDm .DraftEditor-root,.cpESDm .public-DraftEditor-content{height:inherit;text-align:initial;}/*!sc*/ .cpESDm .public-DraftEditor-content[contenteditable='true']{-webkit-user-modify:read-write-plaintext-only;}/*!sc*/ .cpESDm .DraftEditor-root{position:relative;}/*!sc*/ .cpESDm .DraftEditor-editorContainer{background-color:rgba(255,255,255,0);border-left:0.1px solid transparent;position:relative;z-index:1;}/*!sc*/ .cpESDm .public-DraftEditor-block{position:relative;}/*!sc*/ .cpESDm .DraftEditor-alignLeft .public-DraftStyleDefault-block{text-align:left;}/*!sc*/ .cpESDm .DraftEditor-alignLeft .public-DraftEditorPlaceholder-root{left:0;text-align:left;}/*!sc*/ .cpESDm .DraftEditor-alignCenter .public-DraftStyleDefault-block{text-align:center;}/*!sc*/ .cpESDm .DraftEditor-alignCenter .public-DraftEditorPlaceholder-root{margin:0 auto;text-align:center;width:100%;}/*!sc*/ .cpESDm .DraftEditor-alignRight .public-DraftStyleDefault-block{text-align:right;}/*!sc*/ .cpESDm .DraftEditor-alignRight .public-DraftEditorPlaceholder-root{right:0;text-align:right;}/*!sc*/ .cpESDm .public-DraftEditorPlaceholder-root{color:#9197a3;position:absolute;width:100%;z-index:1;}/*!sc*/ .cpESDm .public-DraftEditorPlaceholder-hasFocus{color:#bdc1c9;}/*!sc*/ .cpESDm .DraftEditorPlaceholder-hidden{display:none;}/*!sc*/ .cpESDm .public-DraftStyleDefault-block{position:relative;white-space:pre-wrap;}/*!sc*/ .cpESDm .public-DraftStyleDefault-ltr{direction:ltr;text-align:left;}/*!sc*/ .cpESDm .public-DraftStyleDefault-rtl{direction:rtl;text-align:right;}/*!sc*/ .cpESDm .public-DraftStyleDefault-listLTR{direction:ltr;}/*!sc*/ .cpESDm .public-DraftStyleDefault-listRTL{direction:rtl;}/*!sc*/ .cpESDm .public-DraftStyleDefault-ol,.cpESDm .public-DraftStyleDefault-ul{margin:16px 0;padding:0;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth0.public-DraftStyleDefault-listLTR{margin-left:1.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth0.public-DraftStyleDefault-listRTL{margin-right:1.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth1.public-DraftStyleDefault-listLTR{margin-left:3em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth1.public-DraftStyleDefault-listRTL{margin-right:3em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth2.public-DraftStyleDefault-listLTR{margin-left:4.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth2.public-DraftStyleDefault-listRTL{margin-right:4.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth3.public-DraftStyleDefault-listLTR{margin-left:6em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth3.public-DraftStyleDefault-listRTL{margin-right:6em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth4.public-DraftStyleDefault-listLTR{margin-left:7.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-depth4.public-DraftStyleDefault-listRTL{margin-right:7.5em;}/*!sc*/ .cpESDm .public-DraftStyleDefault-unorderedListItem{list-style-type:square;position:relative;}/*!sc*/ .cpESDm .public-DraftStyleDefault-unorderedListItem.public-DraftStyleDefault-depth0{list-style-type:disc;} ... See the full answer