Please help me on my bloodshed 9.4.4.2 assignment, i need to create a program that will view the name and salary. i already created 1 program but in converting Km to mile and the time of the destination when reach.. here are i need to input and to be an output.

Input:

name of employee:
No. of hours work:
Extra Service hour (OT):
No. of hours late (UT):
Rate per hour;
food deduction:
Extra income:

Output

Employer name:
under time pay:
Over time pay:
Extra Income:
Gross pat:
Net pay:


I already know the computation for the salary and how to view in output, my problem is i dont know how to display the name in output.. hope you can help me guys and thanks in advance.

Recommended Answers

All 2 Replies

First, decide on the appropriate data type for each input and output item. Each of them will need to be a variable (a few might be removed later, but for now, plan on one variable per item, for input and for output. All variables should be local to main(), or to the functions you call from main(). Use no global variables.

If you have to do something like sort the employees by name or pay received, then you'll definitely want to create a struct for these variables, and make the variables into struct members. (records, with fields), and then make an array of these structs.

If not, you can do this using separate variables, and working with just one employee at a time, thus using the same variables for each employee, one after the other. In either case, you first need to decide on the data type for your variables, and what name is easy to associate with what data it holds.

Names are char arrays[], and usually require 30 chars for the surname, and 30 chars for the given (first) name. It's best if the names are separate: lname[30] and fname[30]. With a NULL termination, these chars become C strings, and can be printed with the %s format specification, by printf("%s\n", lname); would print out the lname string and a newline.

Get that together and post up your code, as far as you can get it, and tell us what has you stumped at that time.

Please help me on my bloodshed 9.4.4.2 assignment, i need to create a program that will view the name and salary. i already created 1 program but in converting Km to mile and the time of the destination when reach.. here are i need to input and to be an output.

Input:

name of employee:
No. of hours work:
Extra Service hour (OT):
No. of hours late (UT):
Rate per hour;
food deduction:
Extra income:

Output

Employer name:
under time pay:
Over time pay:
Extra Income:
Gross pat:
Net pay:


I already know the computation for the salary and how to view in output, my problem is i dont know how to display the name in output.. hope you can help me guys and thanks in advance.

you can use string or an array of char type simply and can print names by using loop with this array.

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.