Computer Science Canada

New to C++ help

Author:  mehdij23 [ Sat Jan 14, 2006 4:19 pm ]
Post subject:  New to C++ help

hey every one my name is mehdi and i just started using turbo c++, till my c++ from microsoft arrives. Is there a difference in terms of coding in C++ than trubo C++?


Please give me a feedback because when i put this in Turbo c++ it tells me i have 6 errors.

My Code

#include <iostream>
using namespace std;
int main ()
{
cout <<"hello world";
return 0;
}


Please help me out.....

Author:  wtd [ Sat Jan 14, 2006 4:26 pm ]
Post subject: 

Use a decent, standards-compliant compiler. Like GCC. Turbo C++ is old, and does not comply with modern C++ standards.

Author:  Ninja [ Fri Mar 10, 2006 9:13 pm ]
Post subject: 

hi guys. im new to c++ but ive been doing turing for a few months now. i started to get back into c++ today i downloaded and installed dev c++ and i tried this code out of a book my dad gave me today

# include <iostream.h>
# include <conio.h>

void main ()
{
float x , y , s ;
cout << "Enter the 1st number ";
cin >> x ;
cout << "Enter the 2nd number ";
cin >> y ;
s = x+y
cout << "x= "<<x<<" y= "<<y <<" x+y = "<< s << endl ; getch () ;

it shows many errors first one being conio no such directory found

can someone plz help me out on how to setup dev c++ so it uses the right directories..thanx a lot guys Smile

-NiNjA

Author:  Ninja [ Fri Mar 10, 2006 9:19 pm ]
Post subject: 

also i have linux fedora core 4 running on vmware with win xp as host machine with all the programing utilities pre-installed on it..what program can i use there to learn c++ ?

Author:  wtd [ Fri Mar 10, 2006 9:20 pm ]
Post subject: 

Using Dev-C++ is a mistake. It's buggy. Just use the command-line tools. They work reliably.

Secondly, the code you were given is old and non-standard. Learn standard C++ if you must learn C++ at all. (C++ is an atrocious intro language)

Author:  Ninja [ Fri Mar 10, 2006 9:22 pm ]
Post subject: 

ye thats what i was thinking too lol..this book was printed in like 1996 lol..thanx bro..btw what compiler do u suggest i use rather then dev ?

Author:  idtt2s [ Fri Mar 10, 2006 9:29 pm ]
Post subject: 

Dev-cpp is not a compiler.

I don't do Windows programming or C++ programming but I think that if you 've installed Dev-cpp then you have MinGW installed as well. MinGW is the Windows port of GCC, which is a popular C++ compiler. So I think if you can go to the MinGW directories you can use the command line tools.

type
code:
gcc input -o output

Them you can execute that. I think you can just type the filename in Windows in order to execute that.

And I think Dev-cpp should work fine for study pruposes. It at least lets you type in code and press "Compile & Run". That should be all you need.

Author:  [Gandalf] [ Fri Mar 10, 2006 9:30 pm ]
Post subject: 

Dev-C++ is an IDE, not a compiler. This IDE uses the GCC compiler. The problem with Dev-C++ isn't the compiler it uses, but the actual program (Integrated Development Environment). You should use the GCC compiler with command line tools and a simple editor.

Author:  wtd [ Fri Mar 10, 2006 9:43 pm ]
Post subject: 

[Gandalf] wrote:
Dev-C++ is an IDE, not a compiler. This IDE uses the GCC compiler. The problem with Dev-C++ isn't the compiler it uses, but the actual program (Integrated Development Environment). You should use the GCC compiler with command line tools and a simple editor.


The problem is that in my opinion Dev-C++ does a ghastly job of setting MinGW up, then hides that with a bunch of config options that are hidden from you.

Installing MinGW or Cygwin (or just Linux) is a much better course of action.

Of course, ultimately not using C++ as an intro language is the best advice I can offer.

Author:  Ninja [ Fri Mar 10, 2006 9:50 pm ]
Post subject: 

ye so can i use anything in linux to learn c++?

also i just installg mingw and tried to compile test1.c this is what dos said

iostream : no such directory

syntax erros before ':' token

warning : no new line at the end of file

the code i wrote in there was

#include <iostream>

int main()
{
std::cout << "Hello World." << std::endl;

return 0;
}

Author:  wtd [ Fri Mar 10, 2006 9:53 pm ]
Post subject: 

Linux distros either come with GCC installed or you can easily install it with a package manager. And then you'd have a decent command-line. The prevalence of IDEs is largely the result of Windows being so common, and it having a terrible command-line interface. Wink

And that program looks fine to me. I have no idea why you're getting those errors.

What prior programming experience do you have?

Author:  Ninja [ Fri Mar 10, 2006 10:06 pm ]
Post subject: 

well lol..ive never really done any hardcore programing back in india they started teaching us some old school c++ like the code i posted earlier but then when i moved to canada it kinda got side tracked then i forgot how to use it..ive been doing turing for a few months now but i just wanted to try out c++ because my dad is a pro programmer but he used old c++ before for oracle corp..he was a programer there for 5 years and also a linux/unix server admin..he said if i want to learn programing i should learn c++ after turing or side by side so i just wanted to try it out Smile

Author:  wtd [ Fri Mar 10, 2006 10:10 pm ]
Post subject: 

Well, I have to disagree with your father. He suggested C++ because it's what he knew. I know lots of languages, and I know that C++ always ends up getting in the way.

What do I suggest in its place? Probably at the top of the list would be Ruby or O'Caml.

Author:  Ninja [ Fri Mar 10, 2006 10:27 pm ]
Post subject: 

ye my friend steve from school told me about it..ive never actually used it or even seen it just heard about it..oh well ill start with c++ on linux for now lol Smile..hey man btw u got msn or anything?..if u do add me at rocker_akshay@hotmail.com

Author:  wtd [ Fri Mar 10, 2006 10:46 pm ]
Post subject: 

You really should consider this carefully. You would genuinely benefit from something more expressive than C++.

Author:  Ninja [ Fri Mar 10, 2006 11:05 pm ]
Post subject: 

ye..ill think about that Smile..btw im having a small problem AGAIN!..lol..so i start up fedora on vmware and i open eclipse and what do ya know..it freezes all 3 times..any suggestions ? or other programs that i can use to learn c++ on linux? i have the whole programing package installed on it heres a screenshot of what all i got

http://img49.imageshack.us/my.php?image=screen3aa.jpg

Author:  wtd [ Fri Mar 10, 2006 11:17 pm ]
Post subject: 

Open a text editor (gedit or such). Write your file. Save it. Open a console. Navigate to where you saved your file. Run "g++ myprogram.cpp" then run with "./a.out".

All of the stuff you have there... is overkill considering the level of knowledge you have.

For intro programming at the very least... IDEs are not a good thing.

Author:  Ninja [ Fri Mar 10, 2006 11:57 pm ]
Post subject: 

thanx bro it works all fine now..screw windows im doing this stuff on linux lol..thanx a lot man Smile

Author:  Justin_ [ Sat Mar 11, 2006 1:41 am ]
Post subject: 

Nice, I couldn't get VMWare to work on my machine. It didn't have Fedora 4 listed so I chose Linux and put the FC4 cd in and it said unable to boot from cd. Is there anything you did that was special?

Author:  Ninja [ Sat Mar 11, 2006 9:44 am ]
Post subject: 

hmm..ok bro heres what i did with mine from step 1..if u have any problems just add me on msn if u have it rocker_akshay@hotmail.com..here we go:

on windows host click creat new virtual machine
custom machine
legacy machine
operating system: other linux
choose the patch u want to save your virtual machine at
if u have a gig of ram an ure running win xp as your host os set linux to use 256 for now
use NAT networking not bridged because NAT will share the connection on your current ethernet card
I/O adapter type : SCSI :Bus logic
Creat new virtual disk
SCSI(recommended)
disk size(i set mine to 6 gbs so i could install all 4 cds and update the os too)
and then it will say One 6 gb fille will be saved at this location and just hit finish

Now it will bring u to the page saying start virtual machine and all that
on the right hand side u have to set your cd rom from auto detect to what it actually is ..heres a screenshot of mine

http://img69.imageshack.us/my.php?image=vmware4wf.jpg

then put your fedora cd 1 in windows mode it will open the folder just close it THEN start your virtual machine..it will have a screen saying Vmware ESC for boot meny F12 for network boot hit ESC right away and in the boot meny choose CD ROM..then it will auto read your cd Smile

Author:  Ninja [ Sat Mar 11, 2006 9:49 am ]
Post subject: 

here are the other 2 screenshots after u star your virtual machine

http://img126.imageshack.us/my.php?image=vmware22mw.jpg

http://img126.imageshack.us/my.php?image=vmware32by.jpg

Author:  Justin_ [ Sat Mar 11, 2006 5:15 pm ]
Post subject: 

Thanks bro. I haven't tried it yet, I'm going to right now. Also is your VM version 5.5.1? And another question, does anyone know if Debian will work using 5.5.1? I'd prefer to have it than FC4.

Author:  Justin_ [ Sat Mar 11, 2006 5:20 pm ]
Post subject: 

Ninja, you're my savior man! The problem I had was I left the CD-ROM on auto detect, and since I don't have pnp enabled it wouldn't detect it.

Debian works Laughing

Author:  Ninja [ Sat Mar 11, 2006 5:53 pm ]
Post subject: 

anytime bro Smile..i think so far all the distros i have works on them..ive tried gentoo,debian,ubuntu,fedora4,linux red hat 9,slackware,lycoris,free BSD unix,knoppix and all of em work Smile..but i think 5.5.1 has some issues with the ubuntu 64 bit edition


: