Ok, so this assignment is to create a structure that allows input for up to 6 employees that then makes a 6 structure array showing Employee ID, Employee Last Name, Employee Pay Rate, Employee Hours Worked, Employee Pay, and Total Gross Pay for All Employees.
I don't have a printf yet for total gross, but right now I am just trying to tackle the input. Obviously I am not doing it right because although gcc complier is not giving errors the program is not ending when I type 'q' (sentinel issue) or when I reach 6 employees. It just continues input forever. Here is my code so far:
Code:
//Cameron Taylor
#include <stdio.h>
#define MAXARRAY 6
struct Record{
int idnum;
char lname[20];
double pay_rate;
So I'm trying to make an employee list that holds the information so I can then delete or add from that array. I'm getting some errors regarding overloading function.
Example : Code: struct x { int v[4]; }; const x test = { 0, 1, 2, 3 };
Why can I do this? How does the compiler know to write to this in the proper way? I get that v would be contiguous. Does that have something to do with it?
i'd like to ask if it's possible to fill every array in structure to zero. (Without using too much cycles)Something like this (I know that it doesn't work):
Okay, I'm not entirely certain where my code is messed up, but when I run the console it asks if I want to add Employee information and then it just skips through everything when I say yes.
i need to print the names as they appear in the original file, print the info of the person with the highest distance, print the info sorted by ascending ID number, and print sorted by name alphabetically. the first two parts work fine but sorting by ID and Name dont work.
I have written a program that stores employees in a database object. You can Add, hire, fire, promote, demote, and display employees. The program uses an interface, a database class, and an employee class with member functions.
The strange behavior is in my switch statement in interface.cpp. I have a '#' that represents a command line. Add and Display functions are ok, but if I hire, fire, promote or demote. It will display '##' for the next input. I ran the debugger and after hire/fire/promote/demote is called, the first if-statement goes to 'else' and I'm trying to figure out why.
I am having some trouble with my class assignment. We need to write a C program that will calculate the employee salary. There are 5 employees that will need to be calculated. We are required to use a loop also.
So far this is what I have but I am receiving errors when running the program.
#include <stdio.h> int main() { int clock_num; /* employee clock number */ float gross; /* gross pay for week (wage * hours) */ float hours; /* number of hours worked per week */ float wage; /* hourly wage */ /* Prompt for input values from the screen */ printf ("This is a program to calculate gross pay.
This refers to an ATL COM DLL project. I can successfully create a class hierarchy of objects, ie. say, one class is the TEAM, which then holds other objects, say, a leader and a secretary, both of which are Employee Classes . Here goes my question:
a) In the Team.h header file I declare m_pLeader as a CComPtr<IEmployee>
Code: classATL_NO_VTABLE CTeam : public CComObjectRootEx<CComSingleThreadModel>, public CComCoClass<CTeam, &CLSID_Team>, public IDispatchImpl<ITeam, &IID_ITeam, &LIBID_BUOBJ05Lib, /*wMajor =*/ 1, /*wMinor =*/ 0> { private: CComPtr<IEmployee> m_pLeader; CComPtr<IEmployee> m_pSecretary;
b) The Employee Class is defined within this ATL COM project. c) In the Team.cpp file, I create an instance in the FinalConstruct code, the focus is on the CEmployee
Code: HRESULT CTeam::FinalConstruct(){ CComObject<CEmployee>* pLeader; HRESULT hr=CComObject<CEmployee>::CreateInstance(&pLeader); if (FAILED(hr)) return hr; m_pLeader=pLeader; // ..same for secretary... return S_OK }
d) Here comes my QUESTION: How must I proceed if the Employee object was part of another ATL COM DLL, that is it would be described in another DLL that I would now like to reuse? I guess I need to
1. Have the other DLL's idl-, tlb, and h file in my project folder. Let me name it "other.h, other.idl, other.tlb"
2. Both h- and cpp-file must have an #include "other.h" statement -- please correct if I am wrong..
3. ...but how must in the Team's h- and cpp-files the statements be (assuming the class in the "other" Dll is Member (instead of Employee? I know the following code will NOT work, so I am asking how it should be correctly?
i j x y w h w*h 0 0 0 0 9 11 99 1 0 0 11 9 10 90 2 0 0 21 9 11 99 0 1 9 0 8 12 96 1 1 9 12 8 7 56 2 1 9 19 8 6 48
[Code]...
Code:
struct data { //Here /*! horizontal position */ int x; /*! vertical position */ int y; /*! width */ int w; /
[Code]...
data and then i have an array /*! it contain group_id of each data line*/ int group_id[16]={0,0,0,0,3,3,1,1,1,3,3,2,2,2,2,1}; I never worked with 2D array before. My problem is that i want to create a 2D array of that data for example if i write data[j][i].. It will give me the reference/value of all data lines that belongs to j column, and same with group_id[j][i]. I don't know how i can store these structure vaules in this like 2D array.
I have an array of structure that takes family information (name, age, and state) after it takes the users input it prints back all of the information that was input and then prints the family members that just live in Texas. After that I am trying to implement a function to average out the ages of all family members but I cant seem to get it right, whenever it gets to that part of the program it just outputs 0. I also tried adding an & sign prior to FAMILY[i].age and got an error of int from ptr with no cast.
Also I realize that the code only shows adding of the family members ages which is fine for now as I am concentrated on getting that to work in the first place.
I have to enter the Instructor ID and invokes getFees to find the fees of the given instructor. Then it will displays the message that shows either the fees or "No such instructor ID" if not found. the function prototype is
double.getProfessionFees(string); #include <iostream> using namespace std; const int DECLARED_SIZE = 7; int search(const int a[], int number_used, int target); struct InstructorType
The program that I have written below is working. It calculates a number of payroll type variables and most recently the net pay average (All this is working 100%).
My problem is that I need to add first and last employee names to the program but every time I do this I end up ruining the working program. I've successfully added first and last names to similar programs in the past(ones that make use of an array and while loop) but never to a program that uses functions (I always have problems doing this).
My question is what codes do I use to add a first and last name variable and where do I put those codes within my program so it runs/displays correctly.
I think the coding must be similar to what I've used in the past charr and of course firstname[i] and lastname[i] lines.
Current Input File: 16454025.00 89324020.00 71044012.50 28164026.00 53874021.00 67804013.50 56414011.25
90006025.00 90015020.00 90025523.00
Ideal input file (would include names) Example. 1645 Bob Smith 40 25.00
How to search for a word in a text file and replace it with a new one. Such as employee address, or first name, etc.
Here's my code:
#include <iostream> #include <string> #include <fstream> using namespace std; int main(){ ifstream inFile; //declare ifstream as inFile and ofstream as outFile
[Code] ....
It is under choice 3, most of my program runs correctly but I am just stuck at this part.
I have one requirement to store an array of structure at shared memory. Also the shared memory should have one counter to store number of elements in the array.
I tried to look at some placed but didn't find anything relevant.
So my first question, is it possible that we can store two things on same shared memory. And second if not then how to achieve the same?
I've been able to write the program completing all requirements except for one... creating a function that accepts a nested structure array. Here's the program:
I am trying to write a program for a library system that allow stuff to add, remove, view and delete customer. i try to use file to store data and i open the file in mode read then i store then i put the content of the file into a structure. now the problem started it is only showing me haft of the content and here is the coding.
#include <stdio.h> # include <windows.h> # include <stdlib.h> #include<string.h> #include<conio.h> void search(int s,struct books eli[20]); void view(int x,struct books eli[20]);
Write a payroll program that prompts for the number of hours an employee worked, as well as the employee’s pay rate. If the employee worked for 40 hours or less, the gross pay is calculated by multiplying the number of hours worked by the pay rate. If the number of hours worked by the employee exceeds 40 hours, the employee should receive regular pay for the first 40 hours, and receive time-and-a-half pay for the hours in excess of 40. Display the calculated gross pay on the screen.
Continue to prompt for similar data for more employees and have the gross pay of each employee displayed, until there is no more employee data to process. Then display “Good Bye”.
Your solution must be separated into three source files (Interface, Implementation, and Test)