I am trying to get this While Loop to run, but it keeps only running 1x and then only if I put in a value of 0. If someone could please point out the issue, Thank You
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
std::cout << std::fixed;
std::cout << std::setprecision(2);
//variable declaration
int hours;//hours worked
float wage;//wage agent earns
int month;//month of pay period
int day;//day of pay period
int year;//year of pay period
float grosspay;//gross pay before taxes
float taxes;//tax rate
float netpay;//net pay after taxes
int num_x, num_y;//counter variables
//getting variable for while loop
cout << "Please enter number of agents to input ";
cin >> num_x;
num_y = num_x;
if (num_x < 1)
{
num_y = 0;//setting close program if input is 0
}
while (num_x > 1);
{
cout << "Please Enter the Hours Agent Worked: ";
cin >> hours;
cout << "Please Enter the hourly wage for Agent: ";
cin >> wage;
cout << "Please enter the Month for pay period: ";
cin >> month;
cout << "Please enter the Day for pay period: ";
cin >> day;
cout << "Please enter the Year for pay period: ";
cin >> year;
while (num_x > 1);
Get rid of the ;
It's terminating your while loop.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.