PDA

View Full Version : Programming delama


vague
Mar 13, 2007, 10:47 AM
Hi, my question doesn't exactly include c++, its just I'm at my second year of collage majoring business information systems and I'm having a problem that I know how to write a code in c++ but still I can't really correct my errors , in other words I program using ideas not programming languages so please if you can help me please reply

asterisk_man
Mar 13, 2007, 11:31 AM
So you write code that looks good to you but the compiler spits out errors and you can not recognize what is wrong with your code based on those errors?

Four things I would suggest
#1: pay closer attention to syntax as you write your code. If you're not sure of the syntax for a command look it up instead of guessing. Don't just write code and hope the compiler will fix your problems. That clearly isn't working and it may lead to code that is syntactically correct but logically wrong

#2: you need to learn more about what the compiler is doing. Somewhere in your textbooks it probably describes the steps of compilation. You need to become familiar with what is happening during preprocessing, compilation, and linking. You shouldn't just be running the compiler blindly without knowing what is going on.

#3: ask questions when you don't know what is going wrong. There will probably be a few students who understand the subject better than you do or have already seen the error you're looking at. Work with others as a team (but do your own work and don't rely on them too heavily). You can also post questions here. We'll definitely help you debug compile errors and logic errors. Post plenty of data though, include your source code (preferably with line numbers) and all of the important parts of the compile log.

#4: since you are better with the ideas try to focus on that first. Write your program in english or short hand first. Focus on what you want to do, not how. This is called pseudocode and for any task of moderate complexity or above it should always be used. After you know what you want your program to do you can put your syntax hat on and focus on creating a proper c++ program without getting hung up on the logic.

Don't get discouraged! No one picks it up overnight. Keep practicing and you will improve.

If you have any other questions or comments feel free to post them!

moncoeurdor
Sep 21, 2007, 11:44 PM
hi, my question doesnt exactly include c++, its just i'm at my second year of collage majoring business information systems and i'm having a problem that i know how to write a code in c++ but still i can't really correct my errors , in other words i program using ideas not programming languages so please if you can help me please reply
When you compile or build your program, always start with the very first compiler error listed. Remember that one error could cause many listed compiler errors with only the first listed compiler error valid.

To get an idea of which compiler errors mean what, Write a simple program
and deliberately insert an error. Then build it and note the compiler error messages that appear.

For example:

main (void)
{
int I
I = 5;
}

The semicolon is deliberately left out.