Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part A: #include #include using namespace std; void FormSequence(vector remainTokens, vector pickedTokens) { unsigned int i; int pick; int sum; // ENTER THE MISSING PIECE

Part A:

image text in transcribed

#include #include using namespace std;

void FormSequence(vector remainTokens, vector pickedTokens) { unsigned int i; int pick; int sum;

// ENTER THE MISSING PIECE OF CODE HERE AND TEST IT IN C++. DO NOT MODIFY THE REST OF THE CODE. (THANK YOU) else { for (i = 0; i

int main() { vector tokensToPick(0); vector picks(0); int vectSize; int val; unsigned int i;

cin >> vectSize;

for (i = 0; i > val; tokensToPick.push_back(val); }

cout

--------------------

PART B:

image text in transcribed

#include using namespace std;

void MakeWithdrawal(int totalMonth, int month, int savings) { if (month == totalMonth) { cout

// ENTER THE MISSING PIECE OF CODE HERE AND TEST IT IN C++. DO NOT MODIFY THE REST OF THE CODE. (THANK YOU)

} }

int main() { int totalMonth; int savings; cin >> totalMonth; cin >> savings; MakeWithdrawal(totalMonth, 1, savings); return 0; }

----------

PART C:

image text in transcribed

#include #include using namespace std;

int main() { ofstream outFS; int yucaCount; string friendName;

cin >> yucaCount; cin >> friendName; outFS.open("data.txt"); if (!outFS.is_open()) { cout // ENTER THE MISSING PIECE OF CODE HERE AND TEST IT IN C++. DO NOT MODIFY THE REST OF THE CODE. (THANK YOU) outFS.close(); return 0; }

Integer vectSize is read from input, then vectSize integers are read and stored into vector tokensToPick. Write the FormSequence() base case to output each element in vector pickedTokens whenever the size of pickedTokens is 2 . Output a space after each element. Then, output "sum is " followed by the sum of the elements in pickedTokens. End with a newline. Ex: If the input is 3162141 , then the output is: All possible sequences: 1621 sum is 37 1641 sum is 57 2116 sum is 37 2141 sum is 62 4116 sum is 57 4121 sum is 62 Complete MakeWithdrawal()'s recursive case: - If month is odd, call MakeWithdrawal() to compute the next month's savings as the current month's savings minus 4. - Otherwise, call MakeWithdrawal() to compute the next month's savings as the current month's savings minus 12. Ex: If the input is 5251 , then the output is: Month: 5, savings: 219 Integer yucaCount and string friendName are read from input. An ofstream named outFS is declared and the file named data.txt is opened. Write the following to the opened file: - "Note:" followed by a newline - yucaCount followed by " yucas for ", friendName, and a newline Ex: If the input is 34 Ayaka, then data.txt contains: Note: 34 yucas for Ayaka

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

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions

Question

7. List behaviors to improve effective leadership in meetings

Answered: 1 week ago

Question

6. Explain the six-step group decision process

Answered: 1 week ago