January 27th, 2003, 02:13 PM
|
#1 (permalink)
| | Ultimate Member
Join Date: Jun 2002 Location: Iowa
Posts: 2,879
| Learning C++ (on linux) - my first useable program http://www.techimo.com/photo/showphoto.php?photo=2887
Above is a link to my pic I posted here. It shows my first "useable" c++ program  All it really does is figure the area of a triangle......but we all have to start somewhere
I'm just starting to learn c++ (teaching myself). Seems like the hardest part was getting started. and staying with it. I looked into this awhile back........but got busy with other things and didn't have time to pursue it much. Gonna try again.
For anyone wanting to start........... and you don't have a clue about where to start, or how........ Here is a link to some things I wrote down ,just to have for reference, on getting started. (Please keep in mind that I am just learning myself  ) http://www.crouse.ws/viewforum.php?forum=22
It seems like all the books I started reading "assumed" that I knew how to run a compiler, and the commands for them etc. |
| |
January 27th, 2003, 02:41 PM
|
#2 (permalink)
| | Ultimate Member
Join Date: Oct 2001
Posts: 21,020
|
either that or they start out
... then open MS Visual C++...  |
| |
January 27th, 2003, 07:38 PM
|
#3 (permalink)
| | Member
Join Date: Oct 2001 Location: Belgium
Posts: 112
|
Nice,
It's not easy starting to program under linux, but you will get there 
When i started programming with linux i had a lot of core dumps... but eventually things started working
one of my projects i've never finished... http://users.skynet.be/mrfreeze/Ama3D.png
keep up the good work
MrFreeze
__________________
Life Suxss...
|
| |
January 27th, 2003, 07:52 PM
|
#4 (permalink)
| | Member
Join Date: Jan 2003 Location: Sydney
Posts: 128
|
crouse, what text editor are you using with gcc to write the programs in? I usually use Kate, but it is a bit buggy, and crashes from time to time. |
| |
January 27th, 2003, 11:38 PM
|
#5 (permalink)
| | Ultimate Member
Join Date: Jun 2002 Location: Iowa
Posts: 2,879
|
Right now... I've been using Kate, played with Kwrite, and use bluefish for html only. I might try bluefish with c++ as I like alot of the features it has.
Eventually I might actually get into vim or emacs or something...........but right now I like the ease of Kate, or similar text editors. When I find a limitation that I can't work around I guess I'll have to switch  |
| |
January 27th, 2003, 11:44 PM
|
#6 (permalink)
| | Member
Join Date: Feb 2002
Posts: 161
|
Ah, the allure of the dark side. Welcome to the world of C++  |
| |
January 28th, 2003, 12:09 AM
|
#7 (permalink)
| | Ultimate Member
Join Date: Jun 2002 Location: Iowa
Posts: 2,879
|
Thanks guys............ from the look of my book.......... I've got alot to learn
Years ago.......about 20....... I used to mess around with the BASIC programming language. Actually got halfway decent at it. Alot of the things look "similar". I am going to try to learn something every night........so I don't get bored and quit  Hopefully I don't get too busy either.
At least with Linux.....it isn't costing an arm and a leg to learn. It's all free except for the few books I own on c++.  |
| |
January 28th, 2003, 12:31 AM
|
#8 (permalink)
| | Ultimate Member
Join Date: Oct 2001 Location: Arizona
Posts: 2,538
|  Dude, this is awesome. I've just started programming C++ under Linux, today!  I'm reading a book my QBasic programming teacher (Required lang. They teach it in Programming 1, and in Programming 2 you can program whatever lang you want, & under any platform. Hmm...I wonder what OS I'm gonna program for.  ) gave me. It's called "How To Program C++". I wrote 3 programs today. One that prints text, one that adds two numbers, and one that does some other crap. I've already done these in QBasic, but it's different doing them in C++.  Here's my program I just finished. Code: #include <iostream.h>
int main()
{
int num1, num2;
cout << "Enter two integers, and I will tell you\n"
<< "the relationships they satisfy: ";
cin >> num1 >> num2; // Read two integers
if ( num1 == num2 )
cout << num1 << " is equal to " << num2 << endl;
if ( num1 != num2 )
cout << num1 << " is not equal to " << num2 << endl;
if ( num1 < num2 )
cout << num1 << " is less than " << num2 << endl;
if ( num1 > num2 )
cout << num1 << "is greater than " << num2 << endl;
if ( num1 <= num2 )
cout << num1 << " is less than or equal to "
<< num2 << endl;
if (num1 <= num2 )
cout << num1 << " is greater than or equal to "
<< num2 << endl;
return 0; // Indicate that the program ended successfully
} You guys seem so much farther ahead of me, but I guess thats okay. I'm still learning.  And just FYI, I use Vim to write my programs, and G++ (not GCC. That's for C only) to compile my programs.
Give me a few mins Crouse and I'll produce a program in C++ that does the same thing yours does.  I already did it in QBasic, I just need to "port" it to C++. 
Last edited by Praetorian : January 28th, 2003 at 01:11 AM.
|
| |
January 28th, 2003, 12:37 AM
|
#9 (permalink)
| | Ultimate Member
Join Date: Jun 2002 Location: Iowa
Posts: 2,879
| |
| |
January 28th, 2003, 12:59 AM
|
#10 (permalink)
| | Ultimate Member
Join Date: Oct 2001 Location: Arizona
Posts: 2,538
| Code: #include <iostream.h>
int main()
{
int base, height, area;
cout << "Base of Triangle: ";
cin >> base;
cout << "Height of Triangle: ";
cin >> height;
area = ( base * height ) / 2;
cout << "The area of the triangle is " << area << endl;
} I haven't figured out how to pass it decimals, so it won't work if I do that.  But it works if you just pass it whole numbers.  Tell me if my code sucks or not....
Last edited by Praetorian : January 28th, 2003 at 01:03 AM.
|
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | |
Posting Rules
| You may post new threads You may post replies You may not post attachments You may not edit your posts HTML code is Off | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |