Quiz#2 Part#2

Part 2 was kind of a problem because I had it already but it kept telling me I was incorrect, but I couldn’t figure out the problem, so I called the assistance of Batmantec, and we checked it together for around 20 minutes; finally we discovered that the real problem was that instead of using “>>” in cin… I had “<<” so we weren’t able to do anything while we corrected that, the way we figured out, was by checking both his program and mine at the same time, line by line in order to figure the problem; So thank you Batmantec…

 

Now this time the task was to creat a function where depending on the number the user inserted, the number of * that would appear was the number inserted before, as if the user wrote 3, that would lead into ***  Here is the code, in case you would need it.

Screenshot10.1.png

Before you can write the program, you must write the function for the “stars” which must include a (count = 0), then it must have a do{ which needs to include a cout “*” and which would include (count++) showing that this would add 1 each time the cycle starts again while the (number!=a) is different than the variable; then you end the cycle and save it as stars variable.

 

Then you write the main program, which will ask the user for a number, and place it invariable (a) and then use the “stars” function to display the number of stars = to the number in the variable asked before.

And this is how it would show on the Cygwin

Screenshot10.2

Special Thanks to Batmantec, for helping me solve the problem which didn’t let me work.

CC BY-SA 4.0 Quiz#2 Part#2 by canadamike17 is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.