home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 2819
Discussions: 188,385, Posts: 2,243,510, Members: 232,615
Old January 27th, 2003, 02:13 PM   Digg it!   #1 (permalink)
Ultimate Member
 
crouse's Avatar
 
Join Date: Jun 2002
Location: Iowa
Posts: 2,879
Send a message via ICQ to crouse
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.
__________________
USA Linux Users Group
OpenSUSE.us

crouse is offline   Reply With Quote
Old 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++...

vass0922 is online now   Reply With Quote
Old January 27th, 2003, 07:38 PM     #3 (permalink)
Member
 
MrFreeze's Avatar
 
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...

MrFreeze is offline   Reply With Quote
Old January 27th, 2003, 07:52 PM     #4 (permalink)
Member
 
Join Date: Jan 2003
Location: Sydney
Posts: 128
Send a message via ICQ to stamenkd
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.
stamenkd is offline   Reply With Quote
Old January 27th, 2003, 11:38 PM     #5 (permalink)
Ultimate Member
 
crouse's Avatar
 
Join Date: Jun 2002
Location: Iowa
Posts: 2,879
Send a message via ICQ to crouse
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
crouse is offline   Reply With Quote
Old 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++
Martee is offline   Reply With Quote
Old January 28th, 2003, 12:09 AM     #7 (permalink)
Ultimate Member
 
crouse's Avatar
 
Join Date: Jun 2002
Location: Iowa
Posts: 2,879
Send a message via ICQ to crouse
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++.
crouse is offline   Reply With Quote
Old January 28th, 2003, 12:31 AM     #8 (permalink)
Ultimate Member
 
Praetorian's Avatar
 
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.
Praetorian is offline   Reply With Quote
Old January 28th, 2003, 12:37 AM     #9 (permalink)
Ultimate Member
 
crouse's Avatar
 
Join Date: Jun 2002
Location: Iowa
Posts: 2,879
Send a message via ICQ to crouse
Glad I'm not the only new guy on the c++ block

I am posting most of the stuff I do on my website.......... It's slow going for me........but I do work 40-50 hrs a week and have 2 dogs 2 cats 4 kids.............. and the most understanding wife in the world
crouse is offline   Reply With Quote
Old January 28th, 2003, 12:59 AM     #10 (permalink)
Ultimate Member
 
Praetorian's Avatar
 
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.
Praetorian is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Most Active Discussions
Is It Just Me? (2897)
CPU wont boot (6)
3-days in and no threads about Gaza (160)
The United States Debt (20)
I think I just killed my computer w.. (24)
hp compaq nc6000 problems (139)
Upgrading RAM (5)
Folderchat Weekday thread (442)
Antec 300 bulk purchase? (11)
Recent Discussions
Problem With LightScribe DVD Dr.. (0)
CPU wont boot (6)
GLaDOS is up. (3)
HP notebook reinstall Vista NO .. (5)
Building a gaming computer advi.. (4)
hp compaq nc6000 problems (139)
Folderchat Weekday thread (442)
Creative T-3000 Subwoofer (3)
ACPI controller halt on boot (2)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 10:45 PM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28