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;
}