nm

Recommended Answers

All 3 Replies

Without having looked to much on your code,
I would simply shadow the "numberofpayments" variabel in a greater scope,
and print out the outputline after the main while loop

You can make a variable and put it as the last line in your loop and output the variable that you created AFTER the loop has finished.

I'm just doing what djextreme5 advised you:

You can make a variable and put it as the last line in your loop and output the variable that you created AFTER the loop has finished.

Try the following code:

#include <iostream>
using namespace std;

int main(void)
{
    int i;
    
    for(i = 0; i<10; i++)
    {
        /* This loop is repeated 10 times */
    }
    
    cout << "Times the loop has been repeated: " << i << endl;
    
    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.