13 Replies - 1009 Views - Last Post: 24 July 2011 - 10:00 PM

#1 taolumad  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-January 11

C++ or C#?

Posted 20 June 2011 - 04:24 AM

Hi! I was an IS student last year and learned C in school. I can say that I learned a lot and is very familiar with C but unfortunately, since we're short of time, we weren't able to finish the entire book. I need to skip school this sem, perhaps this year but I would like to convert my learning to either C++ or C#. Can anyone please enlighten me why I should choose which one? thanks
Is This A Good Question/Topic? 0
  • +

Replies To: C++ or C#?

#2 CTphpnwb  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2983
  • Posts: 10,314
  • Joined: 08-August 08

Re: C++ or C#?

Posted 20 June 2011 - 05:26 AM

C# is used with Microsoft's .Net, where C++ is much more cross platform so if you want to be able to write for Mac, Linux, iPhone, iPad, etc. then start with C++.
Was This Post Helpful? 3
  • +
  • -

#3 taolumad  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-January 11

Re: C++ or C#?

Posted 20 June 2011 - 05:45 AM

Thank you. I appreciate your reply. This site would really be very helpful while I learn this by myself... Which one has the highest demand today?
Was This Post Helpful? 0
  • +
  • -

#4 lordofduct  Icon User is offline

  • I'm a cheeseburger
  • member icon


Reputation: 2533
  • View blog
  • Posts: 4,633
  • Joined: 24-September 10

Re: C++ or C#?

Posted 20 June 2011 - 07:03 AM

Depends on the market you are going for which has a higher demand.
Was This Post Helpful? 3
  • +
  • -

#5 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10561
  • View blog
  • Posts: 39,072
  • Joined: 27-December 08

Re: C++ or C#?

Posted 20 June 2011 - 08:11 AM

I agree with lordofduct. Check the job listings in the market you are interested in. They are both pretty mainstream languages, though.
Was This Post Helpful? 1
  • +
  • -

#6 Kilorn  Icon User is offline

  • XNArchitect
  • member icon



Reputation: 1356
  • View blog
  • Posts: 3,528
  • Joined: 03-May 10

Re: C++ or C#?

Posted 20 June 2011 - 08:19 AM

Another thing to consider is that C# is generally a little easier to learn than C++. C++ is a much lower level language than C#, so you'll be required to handle memory allocation, whereas the .NET framework usually handles this for you. C# might be easier to learn, but the ability to communicate with hardware on a lower level with C++ makes it a slightly more versatile language. Not to mention the cross-platform uses for C++. You can do C# cross-platform development, but it requires the use of an open source project known as Mono.
Was This Post Helpful? 2
  • +
  • -

#7 foofo  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 6
  • View blog
  • Posts: 19
  • Joined: 06-May 11

Re: C++ or C#?

Posted 26 June 2011 - 08:30 AM

Understanding the fundamental principles behind the theory of programming is vital. Then all you've got to do is learn the syntax. Why not learn C# and C++,

Quote

get the best of both worlds!

Was This Post Helpful? 2
  • +
  • -

#8 taolumad  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-January 11

Re: C++ or C#?

Posted 29 June 2011 - 04:50 AM

Thanks all for the replies. I so appreciate it. This community will surely help me a lot as I go through my self pace study. I've just started C++ yesterday... I'm pretty comfortable with it since it appears to look like C. :nottalkingtoyou: :online2long:

But I need help, there's something that I don't understand from this code:
----------------------------------------
#include <iostream>

using namespace std;

int main() // Most important part of the program!
{
int age; // Need a variable...

cout<<"Please input your age: "; // Asks for age
cin>> age; // The input is put in age
cin.ignore(); // Throw away enter
if ( age < 100 ) { // If the age is less than 100
cout<<"You are pretty young!\n"; // Just to show you it works...
}
else if ( age == 100 ) { // I use else just to show an example
cout<<"You are old\n"; // Just to show you it works...
}
else {
cout<<"You are really old\n"; // Executed if no other statement is
}
cin.get();
}
----------------------------------------

What does | cin.ignore(); AND cin.get(); | do to the program? I removed it and it works the same...

I'm sorry, I'm such an idiot... :helpsmilie:

Thanks. - Mark
Was This Post Helpful? 0
  • +
  • -

#9 Elliotd123  Icon User is offline

  • New D.I.C Head

Reputation: 12
  • View blog
  • Posts: 37
  • Joined: 24-January 11

Re: C++ or C#?

Posted 29 June 2011 - 04:56 AM

I don't know. Try removing them and see if the program runs fine.

Usually those statements would be used to take care of some complication with an input stream, like if you wanted to handle an instance where the user entered more than one thing in their input

Some aspects of input strings have to be understood in C++. If you input two numbers with a space in between them, the system thinks you entered two completely different inputs, and will put both of those numbers into the stream as two different inputs.

This post has been edited by Elliotd123: 29 June 2011 - 04:58 AM

Was This Post Helpful? 1
  • +
  • -

#10 jamesb1  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 42
  • Joined: 18-May 11

Re: C++ or C#?

Posted 01 July 2011 - 01:03 AM

cin.get() when used at the end of a program actually keeps the console window open so that the user may see the output, if any. What it does is basically wait for the user to input something, so that cin "gets" the input from the command prompt and THEN it will close. Otherwise, once the compiler finishes executing the last line of code, it will just exit from the file.

View Postjamesb1, on 01 July 2011 - 09:01 AM, said:

cin.get() when used at the end of a program actually keeps the console window open so that the user may see the output, if any. What it does is basically wait for the user to input something, so that cin "gets" the input from the command prompt and THEN it will close. Otherwise, once the compiler finishes executing the last line of code, it will just exit from the file.

forgive me guys, posted this on the wrong topic by mistake -_-

oh wait.. I didn't... Dammit.
Was This Post Helpful? 2
  • +
  • -

#11 Jianju  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 15
  • Joined: 11-July 11

Re: C++ or C#?

Posted 13 July 2011 - 10:47 AM

I'm working on learning both. Why? Well, I want the best of both worlds. I want to be able to code at a low level making fast, portable code that leverages the vast array of existing C++ libraries, AND I want to be able to quickly code up Windows apps using things like Unity with C#. Some things I just couldn't imagine doing in pure C++ instead of C#, & vice versa. :gunsmilie:
Was This Post Helpful? 1
  • +
  • -

#12 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1366
  • View blog
  • Posts: 3,443
  • Joined: 28-November 09

Re: C++ or C#?

Posted 23 July 2011 - 10:26 PM

If you like C# and its style as opposed to C++ and still want cross platform then go with Java. It's similar to C# in a surprising number of ways and is far more universal.
Was This Post Helpful? 1
  • +
  • -

#13 stackoverflow  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 164
  • View blog
  • Posts: 545
  • Joined: 06-July 11

Re: C++ or C#?

Posted 24 July 2011 - 06:12 PM

If you program mostly on/for Windows then C# is a good idea. Not to mention, C# skills are often needed so it may be more profitable than C++ these days. If you want to do game programming or programming for the xbox then C# is also handy.

On the other hand, if you want to do programming on many machines and systems then C++ is a good choice. It's considerably more complex, but the skills gained from learning C++ will be valuable. If you can learn C++ then C# should be a simple walk in the park later.

This post has been edited by stackoverflow: 24 July 2011 - 06:12 PM

Was This Post Helpful? 1
  • +
  • -

#14 taolumad  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-January 11

Re: C++ or C#?

Posted 24 July 2011 - 10:00 PM

Thanks to you all. I've read all your responses and it made me think more about it. I'm so glad to have found this community... ;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1