• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

For the average person learning by themselves, Python.
It has good beginner materials available, has clean enough syntax and semantics - not many gotchas, is suitable for a wide variety of applications, and stays relevant as a second language later even if you end up mostly working in another language.

Yeah I agree. Python is a jack of all trades. Great language for beginners wanting to get up and running quickly as there's a huge amount of (both built-in and not built-in) modules.

I'd also recommend JavaScript as a first language. If you're interested in web development, you can pretty much write an entire site in JS now (thanks to NodeJS, grunt, bower, etc). It's not a glorious language syntax-wise, but it's highly functional and easy to write things quickly. You can also do regular computation with NodeJS, though python is preferable for that.
 

Roubjon

Member
I've got a question for you guys.

So I've been working at my first programming job for 2.5 months now and I'm having a very tough time with it. I was essentially given an entire project to do by myself with no previous experience in the field and without much aid. Whenever I did ask for help they'd give me a tip, but then from there I'm all on my own. Which I understand to an extent, because they're doing their own thing and this is my job, not their's. Especially at this point where I've coded the entire project so any help they can give me is so theoretical it's almost useless.

I hold high expectations of myself and don't like to put out bad work, but my progress on this project isn't as great as I'd like it to be. And time and time again after showing my results to my superiors, they'd make suggestions, I'd implement them, and then the results would hardly get any better. Then they'd look at my new results, say "why isn't this working" and the answer is often "because I did what you told me to and it didn't work" I honestly feel like they thought this would be a simple task but they completely had no idea what went into it. Whenever I often try to talk to them about it, they have no idea what it is I even have to do and fail to understand what I'm working with.

Basically work has turned into an incredibly frustrating grind where I come home miserable, don't wanna do anything because I'm tired and angry, and then have to worry about my progress over the weekend and before sleep because my superiors check and send their emails at 1:00 in the morning, which makes me feel like they expect me to come in on the weekends, check my email 24/7, work more often than I am, and become a slave to my job. Not something I'm interested in really.

I should note that for the first month or so, I was doing other work at the job, like using JavaScript to make webpages and it was fine and dandy and I was learning and doing it well.

Any advice?
 
I would to try my hand at making video games. I'm mainly interested in the physics and AI. I don't mind if my games have horrible programmer art. I already know some C++ and I would like to stick to that language. Where should I start? Any books or website I should take a look at?

http://aigamedev.com/

http://altdevblogaday.com/

Programming Game AI by Example

RealTime Collision Detection

3D Math Primer for Graphics and Game Development

Game Engine Architechture

Real-Time Rendering

I realize the last book is on graphics, but honestly its probably one of the most essential texts for games programmers to read, regardless of what specialization they want to go in to.

I've got a question for you guys.

So I've been working at my first programming job for 2.5 months now and I'm having a very tough time with it. I was essentially given an entire project to do by myself with no previous experience in the field and without much aid. Whenever I did ask for help they'd give me a tip, but then from there I'm all on my own. Which I understand to an extent, because they're doing their own thing and this is my job, not their's. Especially at this point where I've coded the entire project so any help they can give me is so theoretical it's almost useless.

I hold high expectations of myself and don't like to put out bad work, but my progress on this project isn't as great as I'd like it to be. And time and time again after showing my results to my superiors, they'd make suggestions, I'd implement them, and then the results would hardly get any better. Then they'd look at my new results, say "why isn't this working" and the answer is often "because I did what you told me to and it didn't work" I honestly feel like they thought this would be a simple task but they completely had no idea what went into it. Whenever I often try to talk to them about it, they have no idea what it is I even have to do and fail to understand what I'm working with.

Basically work has turned into an incredibly frustrating grind where I come home miserable, don't wanna do anything because I'm tired and angry, and then have to worry about my progress over the weekend and before sleep because my superiors check and send their emails at 1:00 in the morning, which makes me feel like they expect me to come in on the weekends, check my email 24/7, work more often than I am, and become a slave to my job. Not something I'm interested in really.

I should note that for the first month or so, I was doing other work at the job, like using JavaScript to make webpages and it was fine and dandy and I was learning and doing it well.

Any advice?

The bolded to me is probably the key part here. Saying "Because I did what you told me to do" is sort of ambiguous. Did you do the requirements you were given or did they just tell you how to implement it? Were the original requirements unrealistic? Did you implement it, it failed to work and you just left it at that? Did you try and solve the problem on your own? When you got stuck did you ask anyone else for help?

Sorry, your post is just really ambiguous so it is hard for me to say. I will say at my first job I had an issue once where I was given a task (figure out what it would take to get networking fixed in our game and outline a plan to add features for our new game). I was given some time to do this, and at the end when I wrote up my report and plan I got reamed by my boss for the lack of effort and detail I put into it, and frankly he was right. However the other part of it was, I had no idea what was expected but I never asked for clarification. Asking for clarification is never wrong in my book, and if you work for or with people who won't or can't provide it then yes, there is a problem and personally I generally don't work with those kinds of people long.
 
Ok people. C# / C-Sharp.

Question:
What is the *best* C# book out there for a COMPLETE noob. (Something of pure quality for a complete noob like the Prata C++ Primer Plus book.)




I have zero programming expertise. I just want to take something that I can run with.
 

luoapp

Member
... Then they'd look at my new results, say "why isn't this working" and the answer is often "because I did what you told me to and it didn't work" I honestly feel like they thought this would be a simple task but they completely had no idea what went into it. ...

Did you eventually find the technical answer to the question "why isn't this working"? A bonus question is, "why didn't I foresee the failure?"
 

upandaway

Member
At the risk of too many resource requests lately in the thread, is there anything you'd recommend for learning C for someone coming from Java or with prior programming knowledge?
I don't mind if it's still something meant for beginners but you personally think it works for more experienced people too
 
At the risk of too many resource requests lately in the thread, is there anything you'd recommend for learning C for someone coming from Java or with prior programming knowledge?
I don't mind if it's still something meant for beginners but you personally think it works for more experienced people too
Kerningham, Ritchie: The C Programming Language, A classic book by the creators of the language. The book hasn't changed since like the 80's but it's still completely relevant today.
 

tuffy

Member
K&R is still the best way to learn C. But I also recommend C: A Reference Manual to go along with it. It not only covers the new additions in C99 but also goes over the syntax and standard libraries in a lot more detail while still being as terse as possible.
 

leroidys

Member
I've got a question for you guys.

So I've been working at my first programming job for 2.5 months now and I'm having a very tough time with it. I was essentially given an entire project to do by myself with no previous experience in the field and without much aid. Whenever I did ask for help they'd give me a tip, but then from there I'm all on my own. Which I understand to an extent, because they're doing their own thing and this is my job, not their's. Especially at this point where I've coded the entire project so any help they can give me is so theoretical it's almost useless.

I hold high expectations of myself and don't like to put out bad work, but my progress on this project isn't as great as I'd like it to be. And time and time again after showing my results to my superiors, they'd make suggestions, I'd implement them, and then the results would hardly get any better. Then they'd look at my new results, say "why isn't this working" and the answer is often "because I did what you told me to and it didn't work" I honestly feel like they thought this would be a simple task but they completely had no idea what went into it. Whenever I often try to talk to them about it, they have no idea what it is I even have to do and fail to understand what I'm working with.

Basically work has turned into an incredibly frustrating grind where I come home miserable, don't wanna do anything because I'm tired and angry, and then have to worry about my progress over the weekend and before sleep because my superiors check and send their emails at 1:00 in the morning, which makes me feel like they expect me to come in on the weekends, check my email 24/7, work more often than I am, and become a slave to my job. Not something I'm interested in really.

I should note that for the first month or so, I was doing other work at the job, like using JavaScript to make webpages and it was fine and dandy and I was learning and doing it well.

Any advice?

This happens to me all the time. It's because they can't be arsed to really look at your code but think themselves brilliant enough to be able to solve it. The only way to get through it is to try and affect the same kind of self confidence they have, and just go for it. With the demands of deadlines and all the overhead that comes with working at a company, you're never going to put out a 100% beautiful, polished, "done" project. You'll always be sacrificing something. With that in mind, make sure that you have a solid spec, and prioritize the functional requirements. If something isn't working right, explain to them that you did what they asked, and if they want more than that, then you need more resources.
 
I would to try my hand at making video games. I'm mainly interested in the physics and AI. I don't mind if my games have horrible programmer art. I already know some C++ and I would like to stick to that language. Where should I start? Any books or website I should take a look at?

Get Unreal and start making little games and prototypes. You get access to their full source you can write everything in C++ and you get a nice editor, a huge community and good documentation. Using it will remove the boiler plate work in getting a game up and running and making tools to get your programmer art into your engine. Instead you can focus on AI and Physics.
 

GabDX

Banned
Thanks to emb, Mr_Appleby, Der Flatulator, rodvik, Purple Cheeto and MikeOfTheLivingDead for the suggestions.

After looking into it, I think I would like to build my own engine, no matter how primitive it ends up looking. What matters to me is motion, collision, the effect of friction and viscosity, etc. This is what I want to work on mostly. For now I don't really care if it's just a bunch of geometrical shapes moving around, as long as they behave properly.
 

Roubjon

Member
This happens to me all the time. It's because they can't be arsed to really look at your code but think themselves brilliant enough to be able to solve it. The only way to get through it is to try and affect the same kind of self confidence they have, and just go for it. With the demands of deadlines and all the overhead that comes with working at a company, you're never going to put out a 100% beautiful, polished, "done" project. You'll always be sacrificing something. With that in mind, make sure that you have a solid spec, and prioritize the functional requirements. If something isn't working right, explain to them that you did what they asked, and if they want more than that, then you need more resources.

Thanks for the advice you guys. Yeah, I've been practicing a couple of things since, such as asking more questions, making them know for sure what it is I'm doing and letting them know what it is I need in order to make my job run more smoothly.

It's helped change my attitude and reflects more what I'm about. Granted, here I am working the entire weekend in the office, but oh well. Deadline on Monday, don't really have a choice here.
 
Any computer science students in here? Lately I've been trying to get a grasp of what compsci students have been up to, what kinds of projects they're tackling.

One thing I've noticed is that students (at least at my school in ubc) don't do a whole lot of personal projects. I've worked on web app development for a few months now, and have two (one in Java, one in node.js) under my github account. I'm wondering how such experience would stack up when it comes to employers.
 
Thanks for the advice you guys. Yeah, I've been practicing a couple of things since, such as asking more questions, making them know for sure what it is I'm doing and letting them know what it is I need in order to make my job run more smoothly.

It's helped change my attitude and reflects more what I'm about. Granted, here I am working the entire weekend in the office, but oh well. Deadline on Monday, don't really have a choice here.

You are in a toxic environment and should really start looking for a new job. They will only expect you to start working through weekends more often now, and the complete lack of understanding of what you will do will never improve. The fact that they send you mails at 1 in the morning tells you a lot about how your superiors are and it is a terrible sign.

Also, why isnt your manager making sure you got the right information and help and shit to make the deadline? That's his job after all. Coming into the office all weekend means the deadline was too tight and should've been moved.
 

phoenixyz

Member
Any computer science students in here? Lately I've been trying to get a grasp of what compsci students have been up to, what kinds of projects they're tackling.

One thing I've noticed is that students (at least at my school in ubc) don't do a whole lot of personal projects. I've worked on web app development for a few months now, and have two (one in Java, one in node.js) under my github account. I'm wondering how such experience would stack up when it comes to employers.
I am still studying so I have no idea how employers react. But in my personal experience there are two types of CS students. Those that are genuinely interested in technology and usually learn all kinds of stuff (especially outside the official curriculum) and those who are genuinely interested in scoring a management position and usually aim for all kinds of industry certificates, but if you ask them about anything currently going on in the tech community they just shrug. The latter is usually the kind which does not have any personal projects at all.
 

Roubjon

Member
Any computer science students in here? Lately I've been trying to get a grasp of what compsci students have been up to, what kinds of projects they're tackling.

One thing I've noticed is that students (at least at my school in ubc) don't do a whole lot of personal projects. I've worked on web app development for a few months now, and have two (one in Java, one in node.js) under my github account. I'm wondering how such experience would stack up when it comes to employers.

I'm still a Comp Sci student. Are you talking about personal projects or school projects? I think the majority of comp sci students aren't really doing any personal stuff, from what I've seen. The ones that do are the ones who are more passionate about it.

For me, I have a job as a Research Assistant at my University so that sucks up a lot of my time for my own personal projects. I'm also a main programmer for a game that is taking way to long to get out b/c of this new job that eats all my time. Which sucks because now I'll have even less time to work on it now that school is starting up again. I'd really like to finish that up too, because I'm pretty tired of working on it and have more fun/better ideas in my head.
 

Kansoku

Member
Any computer science students in here? Lately I've been trying to get a grasp of what compsci students have been up to, what kinds of projects they're tackling.

One thing I've noticed is that students (at least at my school in ubc) don't do a whole lot of personal projects. I've worked on web app development for a few months now, and have two (one in Java, one in node.js) under my github account. I'm wondering how such experience would stack up when it comes to employers.

I'm a student.
I don't know, I did two personal projects between semesters to practice: (half of) a pokedex app for Android and a Chrome extension. I did learn lots of stuff with them and I think that's what matter. Some places might value a "portfolio" of software and stuff, but most would be more interested in what you learned. At least that's how I see it.

Plus, I barely have any time outside of studying, it really gets hard to do anything (especially since I'm learning Japanese on my own, and that ends up taking part of my free time), tho I'm thinking of making a game.
 

cyborg009

Banned
Hey guys what would suggest as a minor I should take? I was planning on doing something in art/graphic design but my friend suggested that accounting would be great for those who want to program.
 

Granadier

Is currently on Stage 1: Denial regarding the service game future
Hey guys what would suggest as a minor I should take? I was planning on doing something in art/graphic design but my friend suggested that accounting would be great for those who want to program.

If your major is CS, I would recommend taking Math as a minor.
 
Hey guys what would suggest as a minor I should take? I was planning on doing something in art/graphic design but my friend suggested that accounting would be great for those who want to program.

I know some people that minored in business and ended up enjoying it. I also know people who minored in classics.
 

P44

Member
Guys, if you guys were at 6-7 months experience in java and had 2 months to build a project to show off for some applications, what's of appreciable complexity that it's impressive.
 

cyborg009

Banned
If your major is CS, I would recommend taking Math as a minor.

Currently I'm IT but might switch to IT with software.

I know some people that minored in business and ended up enjoying it. I also know people who minored in classics.

I heard most people go to the bussiness minor but I wanted something that would be actually useful. I was think Graphic Design before my friend suggested accounting.
 
Any computer science students in here? Lately I've been trying to get a grasp of what compsci students have been up to, what kinds of projects they're tackling.

One thing I've noticed is that students (at least at my school in ubc) don't do a whole lot of personal projects. I've worked on web app development for a few months now, and have two (one in Java, one in node.js) under my github account. I'm wondering how such experience would stack up when it comes to employers.

I'm wrapping up my computer science degree with plans for honours next year. During semester I don't get a heap of time for personal projects, but end up practising weekly for programming competitions and cyber security competitions.

During holidays I usually start (but seldom finish) my own personal projects. Usually web applications used as incentive to learn a new framework such as NodeJS, Rails, Ember, Backbone, etc, or a new programming language.

When it comes to employment I'm not really the one to ask, but I have been told that employers are interested in how interested you are in your field. So doing your own hobby projects and showing them off in interviews is probably a good idea.

As for the type of projects I've been doing, I've done some work in drug design (3D interaction with proteins, etc), information visualisation and artificial intelligence.
 
Just to be clear, Android Studio is the way to go now if I want to work on an app, correct? It seems the ADT plugin for Eclipse is no longer being worked on.
 

Granadier

Is currently on Stage 1: Denial regarding the service game future
Just to be clear, Android Studio is the way to go now if I want to work on an app, correct? It seems the ADT plugin for Eclipse is no longer being worked on.

Correct. There aren't any reasons that I know of to go with ADT+Eclipse over Android Studio right now unless you already had been building an app with ADT and were comfortable with it.

The new Udacity course for development uses Android Studio exclusively.
 
Correct. There aren't any reasons that I know of to go with ADT+Eclipse over Android Studio right now unless you already had been building an app with ADT and were comfortable with it.

The new Udacity course for development uses Android Studio exclusively.

Cool, I'll definitely check it out then.

Thanks.
 
Currently I'm IT but might switch to IT with software.



I heard most people go to the bussiness minor but I wanted something that would be actually useful. I was think Graphic Design before my friend suggested accounting.

There are plenty of reasons why minoring in business can be useful and practical.
 
Any computer science students in here? Lately I've been trying to get a grasp of what compsci students have been up to, what kinds of projects they're tackling.

One thing I've noticed is that students (at least at my school in ubc) don't do a whole lot of personal projects. I've worked on web app development for a few months now, and have two (one in Java, one in node.js) under my github account. I'm wondering how such experience would stack up when it comes to employers.

i always did personal projects during the breaks, usually focusing on/extending skills i learnt the previous semester. it's not something everybody did but i know at least a few others. if your school offers summer projects that's also good - i spent one summer working on building AI bots for unreal tournament using a particular AI method (JACK agents) and that and some of my other projects (eg a game engine written in C that uses Lua for scripting) went down well at a recent interview I had. I think it's totally worth doing and not just for CV but basically to keep knowledge fresh and to keep building your skills.
 

Slavik81

Member
Why do all C/C++ build systems suck? Make is arcane, but I think I might end up going back to it.

Nobody uses boost jam. QMAKE is full of magic. waf is almost ideal but too complicated to extend. Tup is Linux-only.

I have half a mind to write my own build system. Or, maybe I should learn cmake.
 
Question.. I've been working 4 years as of Now..
I've got solid knowledge of java standard and ee stack (and most related frameworks/lib like spring, hibernate, etc) and php (from scratches and using zend)..
As of 3 years i'm quite involved in analysis as well (functional, requirements, take you pick)..
After 4 years without practicing, i've found my c++ skills to be quite rusty..
Any good book i can us to fresh'up my c++ skills?
I'd like a reference book and possibly a cool ok style book.
Suggestion, gaf?
 

CryptiK

Member
So I have written a basic program that reverses digits I put into it. However I used a while and Im not allowed to do that. I can only use the following

int, char, double, cin and cout. With + - / and *

now I have a way of doing it with characters but I would rather do it math way

here is my current program;

pastebin.com/5d4eK5Kp

as you can see Im using WHILE cant use that.
 
D

Deleted member 30609

Unconfirmed Member
are you allowed to use recursion (calling a method from within itself)?
 

Tamanon

Banned
Well, if it's a strict 7 digits, you can reverse the digits by multiplying each entry by a factor of 10. a7*1000000, a6*100000 and the like, add them together and you get a reversed ID number. It's ugly again, though, but with a strict assignment like that, it's going to be.
 
So I have written a basic program that reverses digits I put into it. However I used a while and Im not allowed to do that. I can only use the following

int, char, double, cin and cout. With + - / and *

now I have a way of doing it with characters but I would rather do it math way

here is my current program;

pastebin.com/5d4eK5Kp

as you can see Im using WHILE cant use that.

That problem really is one of string manipulation, not arithmetic.

Simplest way would be:

Code:
#include <iostream>
using namespace std;

int main(void)
{
  char s[8];
  cin >> s;
  cout << s[7] << s[6] << s[5] << s[4]
       << s[3] << s[2] << s[1] << s[0]
       << endl;

  return 0;
}

Mind you might end up getting caught out for stack smashing if the input length is not 8 characters :p

Edit: But if you really must, and can't use loops:

Code:
#include <iostream>
using namespace std;

int main(void)
{
  int in, out = 0;
  cin >> in;
  out += ((in / (int)10e6) % 10);
  out += ((in / (int)10e5) % 10) * 10e0;
  out += ((in / (int)10e4) % 10) * 10e1;
  out += ((in / (int)10e3) % 10) * 10e2;
  out += ((in / (int)10e2) % 10) * 10e3;
  out += ((in / (int)10e1) % 10) * 10e4;
  out += ((in / (int)10e0) % 10) * 10e5;
  out += (in % 10) * 10e6;
  cout << out << endl;

  return 0;
}
 

mltplkxr

Member
Question.. I've been working 4 years as of Now..
I've got solid knowledge of java standard and ee stack (and most related frameworks/lib like spring, hibernate, etc) and php (from scratches and using zend)..
As of 3 years i'm quite involved in analysis as well (functional, requirements, take you pick)..
After 4 years without practicing, i've found my c++ skills to be quite rusty..
Any good book i can us to fresh'up my c++ skills?
I'd like a reference book and possibly a cool ok style book.
Suggestion, gaf?

Accelerated C++ is pretty tight.
 
I've been using C++/C for two years. I started learning Python this past week and decided to solve the same problem in three different languages (like reversing strings) to test my knowledge.

reversing string program in C++: 2hrs
reversing string program in C: 2.5hrs
reversing string program in Python: 15mins

I'm not so sure the C's are for me lol.
 
I've been using C++/C for two years. I started learning Python this past week and decided to solve the same problem in three different languages (like reversing strings) to test my knowledge.

reversing string program in C++: 2hrs
reversing string program in C: 2.5hrs
reversing string program in Python: 15mins

I'm not so sure the C's are for me lol.

C++:

Code:
#include <algorithm>
#include <iostream>
int main() {
  string str = "some string";
  std::reverse(str.start(), str.end());
  std::cout >> str >> endl;
  return 0;
}

Python:

Code:
>>> "some string"[::-1]
'gnirts emos'
 
Top Bottom