Ok, this works now:
for (i = 0; i < MAXARRAY; i++){
payment[i].emp_pay = payment[i].pay_rate * payment[i].hrs_worked;
payment[i].gross_pay += payment[i].emp_pay;
...
Type: Posts; User: Cameron Taylor
Ok, this works now:
for (i = 0; i < MAXARRAY; i++){
payment[i].emp_pay = payment[i].pay_rate * payment[i].hrs_worked;
payment[i].gross_pay += payment[i].emp_pay;
...
Ok, This works, but I am supposed to use 6 structures in the array so I can't do it lol. Just need to figure out how to make payment.gross_pay work.
//Cameron Taylor
#include <stdio.h>...
Ok, I made a new double variable named "total". The net pay of all employees is supposed to be "gross_pay" and emp_pay is the individual employee pay. Their are no taxes being added to the equation,...
Sorry for the long reply, had other stuff to work on (and got hungry). So I think I did everything you said, but I am still getting an issue with the "gross_sum" part of the array to show the gross...
Gonna work from a more simple code for now. Worry about a sentinel and extras after I get the basics working. Right now, the program will continue, but it is printing out 0's for employee payment.
...
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...
Heh, yea. Good analogy. Just sloppy work on my part. Should of done a better job at "proof reading" my code before submitting it just because it worked.
Oh ok, so since extend() acts like a void function it would of been proper to call it a void function. I believe what I was thinking is that it needed to be called "double" since the array amount[]...
Ok, so I had an assignment due a few days ago and I typed it all up myself without any help (pretty proud of myself at the time), but my instructor took off 4 out of 20 points because I didn't make...
I can try to implement that a little later (got other homework to do), but here is my code so far with everything working as is.
Thanks for all the help!
//Cameron Taylor
#include...
Ok, I got leap year down (without do while loop =P). Now to tackle 12/31/2013 - 01/01/2014
//Cameron Taylor
#include <stdio.h>
struct Date{
int month;
int day;
haha, I am not sure. Don't know if I wanna go that far with it yet.
Though, I am thinking I need to do a "do-while" loop anyways in order to do one separate "if-else" chain for leap year and...
Sorry, I missed the braces in the code provide above. Thanks, I have been doing "for" statements so much in the last couple of weeks, I didn't think to not use it lol.
Here is my code that works...
Ok, this is my updated code hopefully with typos fixed and not using %*c to ignore the '/'s'. Though it is still sticking after date input.
//Cameron Taylor
#include <stdio.h>
struct...
Yea, I just realize that right as you posted lol.
Meant for it to be mm/dd/yyyy. Didn't catch the "==" though, rookie mistake.
updating code now.
Ok, for my Sunday homework :frown: I have to find the next day of the year using structures. Now, I can get the structure to read the entered date (tested that with a simple scanf to printf entered...
Thanks for this line!
mpg = ((double) total_mil) / total_gal;
New output all working.
lol, it is perfectly aligned in my txt document. Guess I can't win with pasting it. Even when using...
Ok, I figured it out. It was because in the input file I separated the numbers with tab instead of just a space. Been tweaking it a bit more and this is what i got so far.
#include <stdio.h>
...
#include <stdio.h>
int main()
{
FILE *infile,*outfile;
double car_num, miles, gallons;
double total_gal = 0, total_mil = 0, i;
double mph = 0;
...
This is my output from GCC
I have used -w and -Wall and their are no errors the compiler can find.
Ok, I think I got the main idea of the I/O chapter. Though I think I might be oversimplifying the program because I am getting an interesting error.
Goal here is to read numbers from a file and...
This way was too hard... so I decided to use tokens =P
//Cameron Taylor
#include <stdio.h>
#include <string.h>
int main (){
Should of said "string" in title
Ok, the first assignment was to make a program that just printed an input backwards. Got that, but when it comes to taking what you got from the backwards function to only switching the words back...
Why this:
fprintf(stdout, "\t%d\t%d\n", unsorted[i], sortedArray[i]);
Why use fprintf and stdout instead of just a normal printf("%d %d", unsorted[i], sortedArray[i]);