Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Integer numElements is read from input. Then numElements integers are read and stored in vector numbersList. Write a loop that outputs each element in numbersList

image text in transcribed

Integer numElements is read from input. Then numElements integers are read and stored in vector numbersList. Write a loop that outputs each element in numbersList that is divisible by 9, and adds 1 to each divisible by 9 element. End each output with " is corrected to a number not divisible by 9" followed by a newline.

Ex: If the input is 3 36 54 23, then the output is:

Original numbers: 36 54 23

36 is corrected to a number not divisible by 9

54 is corrected to a number not divisible by 9

Nearest numbers not divisible by 9: 37 55 23

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

#include #include using namespace std;

int main() { int numElements; unsigned int i; vector numbersList; cin >> numElements; numbersList.resize(numElements); for (i = 0; i > numbersList.at(i); } cout

\\ Enter Your Code Here in C++ (Thank you!)

cout Integer numElements is read from input. Then numElements integers are read and stored in vector numbersList. Write a loop tha outputs each element in numbersList that is divisible by 9 , and adds 1 to each divisible by 9 element. End each output with " is corrected to a number not divisible by 9" followed by a newline. Ex: If the input is 3365423 , then the output is: Original numbers: 365423 36 is corrected to a number not divisible by 9 54 is corrected to a number not divisible by 9 Nearest numbers not divisible by 9: 375523

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

Students also viewed these Databases questions

Question

Demonstrate three aspects of assessing group performance?

Answered: 1 week ago