![]() |
HELP please!!!
I've been trying to get the errors of my program corrected for one week, but everytime I correct something I screw up something else. Could anyone help me clear the errors?
:
#include <stdio.h>All help is appreciated. |
Please read a "how to ask a question" thread. You have told us nothing helpful, only that you have some errors and are frustrated. That describes most questioners. Describe what your program is to do (rather than make us inspect closely, and guess), how it is failing to meet your expectations, what compiler errors or linker errors you are getting, even what compiler, OS, and platform you are using. In other words, help us help you in a sensible and, hopefully, more productive way. You will find the "How to post..." thread and the forum's FAQ/rules at the very top of the postings.
|
As Dawei said, you really need to do some work on asking a question in a way that makes it more likely that people can answer, or are willing to answer.
On a quick skim, your compiler will be complaining bitterly about your code. And I am not inclined to do more than a quick skim unless you put in more effort to understanding what is going wrong for yourself. As a rough rule, the best way to handle things when a compiler chokes is to fix the cause of the first error (or warning) first. The reason for this is that early problems can confuse the compiler when it gets to subsequent code. In other words: don't try to start at the bottom of the list of errors from the compiler and work backwards. A couple of quick comments on specific problems in your code follow; 1) The test; :
if ( sweater || t_shirt || shrt || slack ) { :
if (sweater) ...2) Having declared pay_method as a single char (i.e. a single byte), the assignment :
pay_method[i] = "A string";:
char pay_method[some_suitable_length]; |
try this:
give the specific errors you're getting... use these guys here: "/*" and "*/" a little more often. |
Quote:
:
gcc -ansi -O2 -Wall -pedantic -o sweater sweater.c sweater.c:16: warning: return type defaults to `int' |
Did you read Grumpy's response at all? If you don't quite understand what he pointed out, post back; mention what, specifically, bumfoozled you. Do read the "How to Post..." thread; there be good tips there. When it comes to debugging, information is key. When it comes to getting help, information is key. Take a deep breath and realize that we are looking at your problem through YOUR eyes and intellect, not through a crystal ball.
|
Dawei: linuxpimp20 != hamacacolgante
|
I'll take pity. The first warning is with this line;
:
printf("\n Welcome, Costumer # %d \n", cost_id);There will be a logic behind each and every warning or error emitted by any compiler. I've given one example to get you started. Now you just need to go through every warning, work out what the offending code is doing wrong. Then, assuming you understand what you are trying to do with each offending line of code, you can work out how you should rewrite it. One thing to remember is that a compiler cannot read your mind. It interprets the code quite literally. |
| All times are GMT -5. The time now is 1:06 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC