Re: more C programming help

  • From: Nimer Jaber <nimerjaber1@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Tue, 25 Sep 2007 11:04:04 -0600

John Miller wrote:
Hi all,
Now, I have to take last week's assignment and make it loop. I can get some of it to work with the for loop, but not all. I don't know if I'm missing something or what's going on here. Obviously I'm missing something, but I have no clue what. I've pasted the code in below. the first item does loop, but once I start putting the coding in for the rest of it, it comes up with errors, mostly seeming to be focused around the hours line. The class notes are absolutely horrible at explaining this so I pretty much have had to look at sites online and stuff to get as far as I did.

(start code)
#include <stdio.h>

main ()

{

int clock;

/* clock number */

float gross;

/* gross pay */

float hours;

/* hours worked */

float wage;

/* hourly wage */

/* Prompt for input values from the screen */

for ( clock = 1; clock <= 5; ++clock )

printf("enter your employee number: ");

scanf_s("%d", &clock);

printf("employee number %d\n", clock);

for ) hours = 1; hours <= 5; ++hours )

printf("Enter number of hours worked: ");

scanf_s("%f", &hours);

for ( wage = 1; wage <= 5; ++wage )

printf("Enter the wage: ");

scanf_s("%f", &wage);

/* calculate gross pay */

gross = wage * hours;

/* print out employee information to the screen */


printf("This employee worked %f hours with a per-hour basis of %f.\n", hours, wage);

printf(" gross pay is %f.\n", gross);

}

(end code)



Every place I look tells me to do it a little different but I must be close. The clock number does actually work somewhat.

John Miller N1UMJ
AIM and yahoo messenger: N1UMJ Skype: n1umjjohn
home page:
http://home.comcast.net/~n1umj/wsb/html/view.cgi-home.html-.html
myspace: http://www.myspace.com/n1umj
__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind


Try changing it so that it's clock ++ instead of ++ clock
__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: