How to develop a new program

Reply

Join Date: Apr 2004
Posts: 573
Reputation: Dark_Omen is an unknown quantity at this point 
Solved Threads: 5
Dark_Omen Dark_Omen is offline Offline
Posting Pro

How to develop a new program

 
0
  #1
Apr 19th, 2004
I want to know how to get started to make a program in C++. I have read up on the material and I just don't know where to go from there. i would like the program to work on a windows platform.
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 28
Reputation: Bleek is an unknown quantity at this point 
Solved Threads: 0
Bleek Bleek is offline Offline
Light Poster

Re: How to develop a new program

 
0
  #2
Apr 22nd, 2004
well... maybe you haven't read enough... you should start with the simplest program in c++, the "Hello World!" program. you must first #include any header files you need for the specific program, usually <iostream> is used for inputing and outputing. then you must make your int main() function, this is the function where the program starts and ends and must always return 0;... if it returns anything else, the program will not work. then you must start the main function with the opening bracket, {. then you put your lines of code usually followed by a semicolon, ;. then you have to return something because the main function is of int type. so you must have the line return 0;. then you must end the main function with the closing bracket, }.

  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. cout << "Hello World!";
  7. return 0;
  8. }

kind of a bad little tutorial but yea.
study the code, understand what each component does and then and only then, continue with c++... good luck
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 113
Reputation: liliafan is on a distinguished road 
Solved Threads: 2
liliafan's Avatar
liliafan liliafan is offline Offline
Junior Poster

Re: How to develop a new program

 
0
  #3
Apr 23rd, 2004
Originally Posted by Dark_Omen
I want to know how to get started to make a program in C++. I have read up on the material and I just don't know where to go from there. i would like the program to work on a windows platform.
Which compiler are you using?
Application development, webhosting, and much more: www.webcentric-hosting.com
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 1,620
Reputation: kc0arf is a jewel in the rough kc0arf is a jewel in the rough kc0arf is a jewel in the rough 
Solved Threads: 52
Team Colleague
kc0arf kc0arf is offline Offline
Posting Virtuoso

Re: How to develop a new program

 
0
  #4
Apr 23rd, 2004
Hello,

It sounds like you are just learning how to code. Welcome to a wonderful world of coding, debugging, and upkeep.

As long as you are just starting, you may want to remember a few things..... this will help you in the long run:

1) COMMENT. Write out in comments what you want that segment of code to do. Don't think it is silly or redundant... not even COBOL is super descriptive of what the code below should be doing. In your comments, put down what the variables represent, and what you want the code to do with them. Also, as you maintain the code, update your comments.

2) STYLE. Choose names of variables that mean something. For example, if your variable represents an amount of beans in a jar, call that variable beansinjar or something like that. Be careful of case sensitivity... depending on compilers, beans and BEANS could be different variables. Also, space your code out, and use the tab key to block out functions and loops. Your code should be easy to read.

3) FUNCTIONS DO SMALL THINGS. Do not overload what a function does, or you will remove flexibility as the code developes. Have each function only do one small part of the puzzle. A function might open a file, or output to the file. Don't try to have the function save the day.

4) ERROR-CHECK your input values. Don't assume good data will flow into your system. Check for data out-of-bounds, or for numbers that should be letters, etc. Wrong data will just blow up the program (best case) or will allow it to work with garbage results (worst case), as you will get results, but have no idea that the computations may be wrong.

As you continue to code, you will develop wisdom and templates on how your code will grow.

Good luck!

Christian
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 573
Reputation: Dark_Omen is an unknown quantity at this point 
Solved Threads: 5
Dark_Omen Dark_Omen is offline Offline
Posting Pro

Re: How to develop a new program

 
0
  #5
Apr 23rd, 2004
Thanks for the tips. I have read up on all the material and I just don't know how to apply it. I have been writing little programs for a PIC microprocessor but I want to get into deving applications for the computer. My compiler is the Bloodshed Dev-C++ because it is free and I didnt want to spend a lot of money.
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 113
Reputation: liliafan is on a distinguished road 
Solved Threads: 2
liliafan's Avatar
liliafan liliafan is offline Offline
Junior Poster

Re: How to develop a new program

 
0
  #6
Apr 24th, 2004
dev-c++ is cool that is basically gnu gcc ported to windows, if you copy the example from bleek and paste it into your ide , you can then click the "play" button to execute it, it will then compile and run the program, if you want to properly compile you will find the compile command in one of the menus at the top, then just add to that program and play about.
Application development, webhosting, and much more: www.webcentric-hosting.com
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 3597 | Replies: 5
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC