View Single Post
Old 01-13-2005, 01:31 AM   #1 (permalink)
Timber
Registered User
 
Join Date: Jan 2005
Posts: 9
Timber is on a distinguished road
problem with paycode

Hi guys, I am very new to C++ and programming for that matter. I am trying to learn step by step but i always seem to get stuck and examples in books don't seem to help.

Anyway I am having this problem for calculating pay. I need to get the paycode to be automatically assigned to the payrate when the user enters it. How am I to get around it and what am I doing wrong. Thanks
Code:
#include <iostream>
using namespace std;

int main (void)
{
	int i;
	int paycode[4]={0,1,2,3};
	float payrate[5]={10.00, 11.50, 14.00, 20.00};
	float hrs,pay;
	

	
	for (i=0;i<5;i++)

	cout<<"Enter hours worked:"<<endl;
	cin>> hrs;
	cout<<"Enter pay code:"<<endl;
	cin>> code[i];

		
	pay= hrs * code[i];

					
	{
		cout <<"Pay="<<pay<<endl;
	}

	return 0;
}

Last edited by Valmont; 01-13-2005 at 01:59 AM.
Timber is offline   Reply With Quote