New To C++ Or C  | | |
March 22nd, 2005, 10:32 PM
|
#1 (permalink)
| | Senior Member
Join Date: Mar 2005 Location: oklahoma, US
Posts: 557
|
Hey peeps, im brand new to this stuff, i've read the things about the cout, void main () {, etc etc., but i'm a little confused on the input aspect of it, if someone could explain it to me or give me a link to explain it for me.
I also was wondering what programs you used to perform C++ or C programming, i'm not looking to spend over $50 dollars.
Thanks for everything
__________________
RIP TKOP!!
|
| |
March 22nd, 2005, 10:43 PM
|
#2 (permalink)
| | Senior Member
Join Date: May 2002 Location: Rocky Mountain High
Posts: 613
|
If you want some nice tutorials of basic C/C++ concepts, and a good reference for functions as you get started programming, check out CPlusPlus.
I use Visual C++, but that's pretty expensive. I think Borland is a little more reasonably priced, and if you can use a linux machine the compiler and libraries are built into most distributions.
HTH 
__________________
Talking in numbers doesn't make you smarter.
|
| |
March 22nd, 2005, 10:46 PM
|
#3 (permalink)
| | Senior Member
Join Date: Mar 2005 Location: oklahoma, US
Posts: 557
|
Hmm, i have WinXP sadly  ... and that site looks very good for starting aspects of C++, thanks a ton.
I'll just have to look around on google or in local software stores for my programming needs, CompUSA sounds good, or BestBuy.
Would Visual C++(Standard) be a good beginning program???? |
| |
March 22nd, 2005, 10:49 PM
|
#4 (permalink)
| | Real gangstas sip on Yacc
Join Date: Oct 2001 Location: Suckas-ville
Posts: 4,552
|
You can get borlands command line compiler for free. Used it for years.
Jkrohn |
| |
March 22nd, 2005, 10:53 PM
|
#5 (permalink)
| | Senior Member
Join Date: Mar 2005 Location: oklahoma, US
Posts: 557
|
And do you have a link to that or info on where to get that type of software?
Also does it have close to the same features as any other program? |
| |
March 22nd, 2005, 11:06 PM
|
#6 (permalink)
| | Real gangstas sip on Yacc
Join Date: Oct 2001 Location: Suckas-ville
Posts: 4,552
| |
| |
March 22nd, 2005, 11:08 PM
|
#7 (permalink)
| | I am a banana!
Join Date: Jun 2002 Location: Texas Tech
Posts: 3,921
|
visual c++ has by far the most features of any IDE (integrated development environment). You also will not use 99% of its features. I've been doing windows development in C++ for a few years now, and I still only use about 30% of it.
For you, the borland compiler along with notepad is all you need. If you would prefer an IDE, you can check out dev c++ by bloodshed. It's free and is pretty useful. http://www.bloodshed.net/devcpp.html
as for input...keyboard input works like this:
lets say you have a simple program like this Code: #include<iostream.h>
#include<string.h>
void main()
{
string mystring;
cout<<mystring<<endl;
} What we have here is a simple program that declares a string and outputs the string. If you were not already aware, a string is a group of letters "strung" together. An example string is "Hello world needs to die."
To read a string in from the command prompt, add "cin>>mystring" between the other two commands so it looks like this: Code: #include<iostream.h>
#include<string.h>
void main()
{
string mystring;
cin>>mystring;
cout<<mystring<<endl;
} What this does in practice is lets the user type in a string and once they hit enter the string is printed back to the screen. |
| |
March 22nd, 2005, 11:18 PM
|
#8 (permalink)
| | Senior Member
Join Date: Mar 2005 Location: oklahoma, US
Posts: 557
|
Ok what i'm confused about now is how to RUN the programs, do you just go to Run on your start menu?? and what the program's look like when run.
Also the >'s screw me up i never know why they are there. |
| |
March 22nd, 2005, 11:35 PM
|
#9 (permalink)
| | I am a banana!
Join Date: Jun 2002 Location: Texas Tech
Posts: 3,921
|
to run the program you have to first "compile" it. What a compiler does is take c++ code (or some other language) and convert it to machine code (1's and 0's). this is what the borland or dev c++ will do for you. Until you compile it, it's a useless text file. The compiler will also check your code for errors. When you run the program it will be a console program, meaning it will look like a DOS prompt.
for your purposes, the >>'s are just indicators. First you have the cin or cout command, then you have the carrots, which separate the command from the variable(s). The reason cin/cout use carrots instead of spaces is because you can string as many variables on as you want. for example, you could do something like:
cin>>variable1>>variable2>>variable3;
As a side note, endl in a cout statement just does a carriage return (enter). They're just placeholders really. |
| |
March 22nd, 2005, 11:48 PM
|
#10 (permalink)
| | Senior Member
Join Date: Mar 2005 Location: oklahoma, US
Posts: 557
|
Okay i think i understand that,
And when it says prints, does it mean writes it on the screen??
Thanks for all your help ahead of time. |
| | | Thread Tools | Search this Thread | | | | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |