John, yeah, that's the kind of error u go back to when your head's clear & go "dugh!" Lol! I *hate* it when that happens! Send the code & I'll see if I can figure it out. U might also wanna use text pal or something similar, which shows u where matching braces are. 1 thing I like 2 do when I'm coding is to comment the braces, as per the following: main() {/*begins main*/ int i; unsigned int number; for (i=0; i < 5; i++) {/*begins for loop*/ scanf("%d",&number); if number <= 9) printf("single digit territory." elif number > 9 && number < 100) printf("double digits"); else printf("now that's a big number"); }/*ends for loop*/ }/*ends main*/ BTW, I always put my ending brace & comments there immediately after my beginning brace, then go up a line, press enter, & write the code. That way the brace is filled in & u don't forget about it. It took me a lot of years of writing code 2 figure that 1 out & it's saved me a *bunch* of time trying 2 backtrack & figure out where I missed a brace, or, if the program isn't behaving like I want, 2 c the logic of where I've gone wrong w/an errant brace, which, though it may match, is in fact in the wrong place 2 do what the program was supposed 2 do. HTH. On 10/3/07, John Miller <n1umj@xxxxxxxxxxx> wrote: > OK, I thought of that just before getting this email and did that, looks > like the only error left is a fatal one about a brace before the end of the > file or something, I'm guessing I have the bracing wrong but I don't see it, > looks like for every opening brace I have a closing one but I'm closer and I > like this way better actually if I can get rid of this error. > ----- Original Message ----- > From: "Jackie McBride" <abletec@xxxxxxxxx> > To: <programmingblind@xxxxxxxxxxxxx> > Sent: Wednesday, October 03, 2007 5:31 PM > Subject: Re: More C programming help > > > John: > > At the top of every function, you've gotta have a section like: > int clock; > float wage; > float hours; > float overtime; > float overtimepay. > > That is a variable declaration. U failed 2 declare those variables u > just added to your program. > > On 10/3/07, John Miller <n1umj@xxxxxxxxxxx> wrote: > > The "overtime = 40" line is declaring the variable isn't it? That's what I > > thought. > > Which way would you do it? I can get the first way I was doing it to work, > > but with the warning I posted a while ago and after that it works but > > comes > > up with a total that's slightly off. Or this way where that is the problem > > as well as, I think the same warning. I'd have to try it again to see if > > it's the same warning or not. There was a fatal error in there too but I > > think that was something about the braces, very likely that will be fixed > > when the rest of it's fixed. > > ----- Original Message ----- > > From: "Martin Slack" <m.g.slack@xxxxxxxxxxxx> > > To: <programmingblind@xxxxxxxxxxxxx> > > Sent: Wednesday, October 03, 2007 5:10 PM > > Subject: Re: More C programming help > > > > > > > Hi John, > > > > > > The change in formula which you are trying is not strictly necessary, > > > but > > > bear in mind that for the c language, *ANY* variables you use *MUST* be > > > declared first. > > > > > > hth > > > > > > Martin > > > > > > > > > ----- Original Message ----- > > > From: "John Miller" <n1umj@xxxxxxxxxxx> > > > To: <programmingblind@xxxxxxxxxxxxx> > > > Sent: Wednesday, October 03, 2007 9:30 PM > > > Subject: Re: More C programming help > > > > > > > > >>I tried that and over time and overtime pay undeclared variables is the > > >>error it likes to torture me with now. > > >> ----- Original Message ----- > > >> From: "TJ McElroy" <raider.59@xxxxxxxxxxxxx> > > >> To: <programmingblind@xxxxxxxxxxxxx> > > >> Sent: Wednesday, October 03, 2007 1:48 PM > > >> Subject: Re: More C programming help > > >> > > >> > > >>> Your problem: > > >>> > > >>>> gross = wage * hours + 0.5 (hours - 40); > > >>> > > >>> for some reason, the compiler doesn't like it. > > >>> > > >>> *** > > >>> The compiler does not like it, because it thinks that > > >>> 0.5 (hours - 40); > > >>> > > >>> is a function call. > > >>> > > >>> Try breaking the if statement into two statements > > >>> > > >>> if ( hours > 40 ) { > > >>> overTime = hours - 40; > > >>> overTimePay = .05 * overTime; > > >>> gross = wage * hours + overTimePay; > > >>> } else { > > >>> gross = wage * hours; > > >>> } > > >>> > > >>> *** > > >>> also by not having this if statement inside the for loop, > > >>> it will calculate all of the employees time, not > > >>> each individual employee. > > >>> > > >>> hth > > >>> > > >>> > > >>> > > >>> > > >>> ----- Original Message ----- > > >>> From: "John Miller" <n1umj@xxxxxxxxxxx> > > >>> To: <programmingblind@xxxxxxxxxxxxx> > > >>> Sent: Wednesday, October 03, 2007 12:10 PM > > >>> Subject: Re: More C programming help > > >>> > > >>> > > >>>> Well, the what the program should do is there, but the line that is > > >>>> > > >>>>> gross = wage * hours + 0.5 (hours - 40); > > >>>> > > >>>> for some reason, the compiler doesn't like it. > > >>>> error is > > >>>> Error 1 error C2064: term does not evaluate to a function taking -22 > > >>>> arguments > > >>>> > > >>>> I usually do walk away for a bit when I get frustrated but it's the > > >>>> headaches I get after going back a few times that are really starting > > >>>> to concern me. I know I'm close, if I do different, easier math in > > >>>> that > > >>>> line like just adding 1 or something it will work changing it a bit, > > >>>> but when I do it this way, which looks right to me, it just doesn't > > >>>> like it. I'm sure I'm missing something simple again. I've been close > > >>>> right along I feel like, but lagging behind, I'm not sure if it's me, > > >>>> a > > >>>> Braille display would have probably helped with the last one but I > > >>>> can't afford that and was pretty much told "no" by the state when I > > >>>> wanted one for another class, it's too late now anyway week 5 or 10 > > >>>> starts tomorrow. > > >>>> ----- Original Message ----- > > >>>> From: "Marlon Brandão de Sousa" <splyt.lists@xxxxxxxxx> > > >>>> To: <programmingblind@xxxxxxxxxxxxx> > > >>>> Sent: Wednesday, October 03, 2007 11:01 AM > > >>>> Subject: Re: More C programming help > > >>>> > > >>>> > > >>>>> Hello John, > > >>>>> Let me tell you this: when you look at a hard programming task as if > > >>>>> it was a person and it was your enemy the probability of comming > > >>>>> with > > >>>>> the solution is smaller. Try to look at it as if you did not deppend > > >>>>> on that, if you get frustrated of thinking and going to aparent > > >>>>> noware > > >>>>> then go take a break, and back again to it latter. Don't start > > >>>>> thinking that you're likely to fail or that you don't like to have > > >>>>> all > > >>>>> the work to try it again and again ... It may appear a joke, but it > > >>>>> does make the difference if you get yourself in a relaxed stat so > > >>>>> you > > >>>>> can consentrate more on your problem and less in your fears and > > >>>>> frustrations ... > > >>>>> This said, I'll ask you to explain me what you're trying to do, > > >>>>> because I can not see what is the problem here. > > >>>>> I didn't try to compile your code but the sintax seen ok ... so what > > >>>>> is the problem? > > >>>>> Marlon > > >>>>> 2007/10/3, John Miller <n1umj@xxxxxxxxxxx>: > > >>>>>> Hi everyone. > > >>>>>> Here we go again, now, where I should be at with this program is, a > > >>>>>> program > > >>>>>> that will figure out the wages for 5 employees, and now adding an > > >>>>>> if > > >>>>>> statement to figure out overtime. I've been working on this for 2 > > >>>>>> days and > > >>>>>> this is what the code ends up looking like, I can make it work if I > > >>>>>> change > > >>>>>> it to do the wrong thing, but when it comes time to get it right, I > > >>>>>> can't > > >>>>>> make it work and I'm at a complete loss. If I do it with different > > >>>>>> math, > > >>>>>> just make it add a few things with the same coding, that works so I > > >>>>>> knwo I'm > > >>>>>> on the right track, but when it comes to doing the finished > > >>>>>> project, > > >>>>>> I'm > > >>>>>> missing something. I had to stop yesterday for the second worst > > >>>>>> headache > > >>>>>> I've ever had in my life, seems like I get those headaches every > > >>>>>> time > > >>>>>> I work > > >>>>>> on this junk but I need the class. > > >>>>>> > > >>>>>> (begin code( > > >>>>>> #include <stdio.h> > > >>>>>> > > >>>>>> int main (void) > > >>>>>> > > >>>>>> { > > >>>>>> > > >>>>>> int clock; > > >>>>>> > > >>>>>> /* clock number */ > > >>>>>> > > >>>>>> float gross; > > >>>>>> > > >>>>>> /* gross pay */ > > >>>>>> > > >>>>>> float hours; > > >>>>>> > > >>>>>> /* hours worked */ > > >>>>>> > > >>>>>> float wage; > > >>>>>> > > >>>>>> /* hourly wage */ > > >>>>>> > > >>>>>> { > > >>>>>> > > >>>>>> int i; > > >>>>>> > > >>>>>> /* Prompt for employee information */ > > >>>>>> > > >>>>>> for (i = 0; i <=5; ++i) > > >>>>>> > > >>>>>> printf("enter your employee number: "); > > >>>>>> > > >>>>>> scanf_s("%d", &clock); > > >>>>>> > > >>>>>> printf("Enter the wage: "); > > >>>>>> > > >>>>>> scanf_s("%f", &wage); > > >>>>>> > > >>>>>> printf("Enter number of hours worked: "); > > >>>>>> > > >>>>>> scanf_s("%f", &hours); > > >>>>>> > > >>>>>> } /* end for */ > > >>>>>> > > >>>>>> /* attempting if statement for overtime*/ > > >>>>>> > > >>>>>> if ( hours > 40 ) > > >>>>>> > > >>>>>> /* calculate gross pay */ > > >>>>>> > > >>>>>> gross = wage * hours + 0.5 (hours - 40); > > >>>>>> > > >>>>>> else gross = wage * hours; > > >>>>>> > > >>>>>> /* print out employee information to the screen */ > > >>>>>> > > >>>>>> printf > > >>>>>> ("\t----------------------------------------------------------\n"); > > >>>>>> > > >>>>>> printf ("\tClock# Wage Hours Gross\n"); > > >>>>>> > > >>>>>> printf > > >>>>>> ("\t----------------------------------------------------------\n"); > > >>>>>> > > >>>>>> printf ("\t%06i %5.2f %5.1f %7.2f\n",clock,wage,hours,gross); > > >>>>>> > > >>>>>> printf("This employee worked %f hours with a per-hour basis of > > >>>>>> %f.\n", > > >>>>>> hours, wage); > > >>>>>> > > >>>>>> printf(" gross pay is %f.\n", gross); > > >>>>>> > > >>>>>> return 0; > > >>>>>> > > >>>>>> } > > >>>>>> > > >>>>>> *end code > > >>>>>> > > >>>>>> __________ > > >>>>>> 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 > > >>>>> > > >>>> > > >>>> __________ > > >>>> View the list's information and change your settings at > > >>>> //www.freelists.org/list/programmingblind > > >>> __________ > > >>> View the list's information and change your settings at > > >>> //www.freelists.org/list/programmingblind > > >>> > > >> > > >> __________ > > >> View the list's information and change your settings at > > >> //www.freelists.org/list/programmingblind > > >> > > >> > > > > > > __________ > > > View the list's information and change your settings at > > > //www.freelists.org/list/programmingblind > > > > > > > __________ > > View the list's information and change your settings at > > //www.freelists.org/list/programmingblind > > > > > > > -- > Jackie McBride > Check out my homepage at: > www.abletec.serverheaven.net > __________ > View the list's information and change your settings at > //www.freelists.org/list/programmingblind > > __________ > View the list's information and change your settings at > //www.freelists.org/list/programmingblind > > -- Jackie McBride Check out my homepage at: www.abletec.serverheaven.net __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind