Hi all...

Basically I'm wondering how I complete a loop based on the number of times a user requests it.

For instance, I'm doing an employee system that works out pay based on hours. There are lots of rules/criteria about what they pay is recieved based on the input hours. This I have done though (probably no point posting the code of this bit)

After the user types in how many employees wages he wants to process, say 5 times, the loop occurs 5 times, with the user entering hours 5 times.

Finally, all hours, wages totals and of each is shown. I'm hoping to achieve something a like this!!

thanks!:)

Recommended Answers

All 2 Replies

#include <iostream>

using namespace std;

int main()
{
    int empNum = 0;
    cout << "Enter A Number: "; cin >> empNum;

    for (int i=0; i < (int)empNum; i++) {
        cout << "Loop " << i << endl;
    }

    return 0;
}

Thanks!!!!!!!!!!!!!!!! x Lucy

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.