Re: more C programming help

  • From: "Marlon Brandão de Sousa" <splyt.lists@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Tue, 25 Sep 2007 14:11:50 -0300

Hello,
You have logical and typographycal errors. If I understood well, you
want to calculate the gross pay for 5 emploieis. If this assumption is
correct, the algoritim you used won't work.
I won't explain you why, because this is what will worth your
assignment. I, however, will show you the reazon why your compiler is
failing.
First of all, you said:

"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."

I already said it to you, and I will say it again: DO NOT ASSUME THAT
EVERYONE is aware about what you're trying to do. I have no idea about
what could be the hours line, because I found at least five lines
countaining references to the word hours.
Again, I examined carefully and found that the line you perhaps are
referring to is this:
for ) hours = 1; hours <= 5; ++hours )
If this is the line the compiler is complaining, and I have excelent
reazons to think it is, please read it with atention and see if you
can find what is goind wrong with it. I will say it again, turn your
jaws punctuations level to all and read it, or do it better and read
it character by character and see what is wrong on it.
If you can not find yourself on it let us know.
hth
Marlon


2007/9/25, John Miller <n1umj@xxxxxxxxxxx>:
> 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
>
>


-- 
When you say "I wrote a program that crashed Windows," people just
stare at you blankly and say "Hey, I got those with the system, for
free."
Linus Torvalds
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: