Is anyone here good with c++?

  • 63 results
  • 1
  • 2
Avatar image for magnablue
magnablue

10500

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 1

Because I have a programming class that is c++ and I know the basics of it. It's just when I get around to debugging it is when I run into problems.

Right now I need help because I used the setprecison command to make spaces between text. And the program is telling me that I set it as a variable that hasn't been declared. I have no idea how to fix it.

Avatar image for mrhamwallet
MrHamWallet

3194

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

If I were a comic book hero then C++ would be my main villain, I hate C++ (and programming in general) so much and it knows it.

Avatar image for buttersdaman000
buttersdaman000

23713

Forum Posts

60

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

Avatar image for deactivated-579e79a09210d
deactivated-579e79a09210d

3799

Forum Posts

5855

Wiki Points

0

Followers

Reviews: 1

User Lists: 4

C++ is useless unless you are programming games. Java is what colleges and schools are currently focusing on.

Avatar image for magnablue
magnablue

10500

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 1

Avatar image for chazz85
Chazz85

5201

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#6  Edited By Chazz85

@reaperonyx: I strongly disagree C++ is only usefull when coding games. Yet i go to the best tech based college in my city and we focus on C# and web development. Then again there is a heavy influence on games design there.

Avatar image for mysoulz
mysoulz

871

Forum Posts

14

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@chazz85: JavaScript is also popular in the industry.

Avatar image for chazz85
Chazz85

5201

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@mysoulz: It is popular in the industry iam aware of this. Yet iam probably quite close minded on what languages i use since i have only programmed games and not websites or general software.

Avatar image for magnablue
magnablue

10500

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 1

cout << setprecision(17) << fixed;

cout << "Your Name:" << endl;

cout << setprecision(9)<< fixed;

cout << "Number of quarters:" << endl;

cout << setprecision(12)<< fixed;

cout << "Number of nickels" << endl;

cout << setprecision(12)<< fixed;

cout << "Number of pennies:" << endl;

cout<< setprecision(13) << fixed;

cout << "Total amount:" << endl;

This is the code in question.

45: error: ‘setprecision’ was not declared in this scope

That's the error

Avatar image for buttersdaman000
buttersdaman000

23713

Forum Posts

60

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#10  Edited By buttersdaman000

@hylian:

Did you include iomanip?

Oh, and it's cout.precision(); for decimal places

NVM again lol you want spaces between text? Use setw()...like

cout << setw(5) << "Poop \n";

will display:

_poop

(the underscores won't be in there though)

Avatar image for magnablue
magnablue

10500

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 1

@buttersdaman000: I have no idea what iomanip is. And I just tried what you just said with the setw(). And it still doesn't work.

cout << setw(17) << "Your Name:" << endl;

cout << setw(9) << "Number of quarters:" << endl;

cout << setw(12) << "Number of nickels" << endl;

cout << setw(12) << "Number of pennies:" << endl;

cout << setw(13) << "Total amount:" << endl;

Avatar image for mysoulz
mysoulz

871

Forum Posts

14

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@chazz85: Understandable. I uses it for Single Page Applications (AngularJS) along with other frameworks. It's a wonderful experience.

Avatar image for buttersdaman000
buttersdaman000

23713

Forum Posts

60

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

Avatar image for spitfirepanda
SpitfirePanda

2573

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 2

I think that's my blood type.

Avatar image for magnablue
magnablue

10500

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 1

Avatar image for buttersdaman000
buttersdaman000

23713

Forum Posts

60

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

Avatar image for willpayton
willpayton

22502

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@hylian: Did you solve your problem?

Avatar image for mysoulz
mysoulz

871

Forum Posts

14

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

Avatar image for willpayton
willpayton

22502

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@mysoulz said:

@willpayton: You program too?

Yes. If you have problems with c++ I can probably help. I think your problem above is only that you needed to include the header <iomanip>. Otherwise the compiler wont know what that function is.

Avatar image for thelurker
TheLurker

1148

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

C# and Java are as far as I go as of now. I was told that c++ wasn't needed for game dev.

Avatar image for willpayton
willpayton

22502

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

C# and Java are as far as I go as of now. I was told that c++ wasn't needed for game dev.

Depends on what you want to accomplish or if you want to work at a game dev studio.

Avatar image for willpayton
willpayton

22502

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

C++ is useless unless you are programming games. Java is what colleges and schools are currently focusing on.

There's many other areas besides game development where c++ is used, and usually for good reasons.

Avatar image for mysoulz
mysoulz

871

Forum Posts

14

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@willpayton: Cool. I don't program in C++. I think your comment was meant for someone else that needed help on the subject.

C++ is useless unless you are programming games. Java is what colleges and schools are currently focusing on.

I honestly wouldn't say that. C++ is still regarded as a traditional language where applications are still used, which the browser that you're using is coded with C++. If you know proper coding structure, programming logic, tasks, optimization for better efficiency, the only real difference here would really be syntax. Java is widely popular, because it can be used for mobile development (considering how smartphones are widely popular today); such as the Android OS among other things.

Avatar image for magnablue
magnablue

10500

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 1

#24  Edited By magnablue
Avatar image for buttersdaman000
buttersdaman000

23713

Forum Posts

60

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

Avatar image for magnablue
magnablue

10500

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 1

#26  Edited By magnablue
Avatar image for buttersdaman000
buttersdaman000

23713

Forum Posts

60

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@hylian said:

@buttersdaman000: ....

I didnt

Ah, misread WillPaytons post...

but really, setw should work....just put it after every word....

Avatar image for magnablue
magnablue

10500

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 1

This is what I have

cout << setw(17) << "Your Name:" << endl;

cout << setw(9) << "Number of quarters:" << endl;

cout << setw(12) << "Number of nickels" << endl;

cout << setw(12) << "Number of pennies:" << endl;

cout << setw(13) << "Total amount:" << endl;

}

Avatar image for buttersdaman000
buttersdaman000

23713

Forum Posts

60

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@hylian said:

This is what I have

cout << setw(17) << "Your Name:" << endl;

cout << setw(9) << "Number of quarters:" << endl;

cout << setw(12) << "Number of nickels" << endl;

cout << setw(12) << "Number of pennies:" << endl;

cout << setw(13) << "Total amount:" << endl;

}

And you want spaces between.....each cout statement or each word in the cout statements???

Avatar image for magnablue
magnablue

10500

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 1

What I want is

Your name: Name

Number of quarters: quarters

ect

Avatar image for buttersdaman000
buttersdaman000

23713

Forum Posts

60

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@hylian:

Then just use \n as many times as you want.

Here, I just wrote code doing both things...

#include <iostream>

#include <iomanip>

using namespace std;

int main (){

cout << "Your " << setw(6)<< "pants" << setw(6)<<"are"<< setw(6)<<"on"<<setw(6)<< "fire" <<setw(6)<<endl;

cout << "This is a big \n\n\n\n\n\n\n\n\n\n\n\n\n" <<"space"<<endl;

return 0;

}

The first cout statement pus spaces between each word, but there might be an easier way of doing that...the second puts 13 blank new lines between big and space.

Avatar image for magnablue
magnablue

10500

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 1

Avatar image for buttersdaman000
buttersdaman000

23713

Forum Posts

60

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#33  Edited By buttersdaman000
Avatar image for magnablue
magnablue

10500

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 1

@buttersdaman000:

#include <iostream>

using namespace std;

#include <string>

#include <iomanip>

int main()

{

std::string name;

double quarters, dimes, nickels, pennies;

float total;

//Get the name of the user

cout << " What is your name?";

cin>> name;

//Get the amount of quarters

cout << "How many quarters do you have?";

cin >> quarters;

//Get the amount of dimes

cout << "How many dimes do you have?";

cin >> dimes;

//Get the amount nickels;

cout << "How many nickels do you have?";

cin >> nickels;

//Get the amount of pennies

cout << "How many pennies do you have?";

cin >> pennies;

//Get the total

total= (.25*quarters)+(.1*dimes)+(.05*nickels)+(.01*dimes);

cout << "Your Name:" << setw(17) << name << endl;

cout << "Number of quarters:" << setw(9) << quarters << endl;

cout << "Number of nickels:" << setw(12) << nickels << endl;

cout << "Number of pennies:" << setw(12) << pennies << endl;

cout << "Total amount:" << setw(13) << total << endl;

return 0;

}

Avatar image for magnablue
magnablue

10500

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 1

Avatar image for chazz85
Chazz85

5201

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@mysoulz: I may try it sometime. Lol i don't even know C++ and can't fix this error idk why i came to this thread...

Avatar image for thelurker
TheLurker

1148

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@thelurker said:

C# and Java are as far as I go as of now. I was told that c++ wasn't needed for game dev.

Depends on what you want to accomplish or if you want to work at a game dev studio.

Yeah, I meant, I was told it was useless for hobby and small indie projects. I hear c++ it's still is still the AAA industry standard, sadly.

Avatar image for willpayton
willpayton

22502

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@willpayton said:
@thelurker said:

C# and Java are as far as I go as of now. I was told that c++ wasn't needed for game dev.

Depends on what you want to accomplish or if you want to work at a game dev studio.

Yeah, I meant, I was told it was useless for hobby and small indie projects. I hear c++ it's still is still the AAA industry standard, sadly.

I think c++ can be very good for hobby projects, especially if you're willing to put in some time to learn what you're doing. Modern c++11 has a lot in it that makes writing c++ code easier than before. And, if you want to do graphics with c++ but dont want to go all the way into learning OpenGL or DirectX, there's Cinder and OpenFrameworks that I've heard good things about.

As far as the game industry, yes c++ is the standard and everyone from small developers to AAA studies use it. There's really nothing sad about it, although I know that a lot of people starting out think that c++ is some horribly difficult beast to learn. It's not. I actually started programming with c++ and it was fine. The reason the game industry uses is are... well, there's several reasons. There's tons of existing code and libraries, a lot of experienced c++ developers to hire, all devices have c++ APIs and compilers (in some cases that's all you can use), and above all c++ gives you the ability to get the best performance from all the languages that are available. c++ isnt perfect, but it's the best there is if you want to write applications that need to perform well, for the most part.

I recommend really looking into it and seeing what the features of modern c++11 are before you write it off. If you want to do graphics, look into one of the two libraries above.

Avatar image for thelurker
TheLurker

1148

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@willpayton: I really do wish I knew c++. It's just unfortunately, I looked at it when I was just getting into scripting. I knew a bit of java and figured that I was experienced enough to write a simple OpenGL game engine. I downloaded NetBeans for c/c++ opened up some youtube tutorials and got started. Needless to say, it cut my ego into tiny pieces. I felt so stupid trying and failing to understand what I was doing that I nearly dropped coding completely. But luckily I decided to keep at it. I continued with java and started c# and recently html (which is a walk in the park by this point) and never looked back to c++.

Avatar image for rouflex
Rouflex

35970

Forum Posts

16652

Wiki Points

0

Followers

Reviews: 0

User Lists: 3

#40  Edited By Rouflex

Never had classes like those...

Pilasy:La Voix d'un homme

Avatar image for willpayton
willpayton

22502

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@willpayton: I really do wish I knew c++. It's just unfortunately, I looked at it when I was just getting into scripting. I knew a bit of java and figured that I was experienced enough to write a simple OpenGL game engine. I downloaded NetBeans for c/c++ opened up some youtube tutorials and got started. Needless to say, it cut my ego into tiny pieces. I felt so stupid trying and failing to understand what I was doing that I nearly dropped coding completely. But luckily I decided to keep at it. I continued with java and started c# and recently html (which is a walk in the park by this point) and never looked back to c++.

If you've already been programming a while in c# and java, then you can pick up c++ pretty easily. I dont know of any good books to recommend for c++11, but a little research will probably yield some good results. And, yeah, trying to jump right into OpenGL or DX with little experience in graphics will be demoralizing. Like I said above, look into OpenFrameworks or Cinder. They allow you to do graphics similar to OGL or DX but in a much, much simpler way.

Avatar image for thelurker
TheLurker

1148

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#42  Edited By TheLurker

@willpayton:

I have like four different IDEs on my PC, so I might as well try it again when I get the time.

No one ever really encouraged me to try c++.

It's usually the opposite. Either they're a game dev that tried it and had an experience as bad, or worse than my own; they knew it, but felt it was obsolete and not worth the hassle; or they knew it and felt that they were apart of some elite club, trying to dissuade the noob by telling me all the hard work they did to get to were they are now. And saying that I should stick with my amateur languages because I'm not hardcore enough.

(EDIT) I just watched a the beginning of a beginner tutorial in c++. It does look a bit easier to grasp than last time. I'm gonna give it a shot this weekend. :)

Avatar image for willpayton
willpayton

22502

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@willpayton:

I have like four different IDEs on my PC, so I might as well try it again when I get the time.

No one ever really encouraged me to try c++.

It's usually the opposite. Either they're a game dev that tried it and had an experience as bad, or worse than my own; they knew it, but felt it was obsolete and not worth the hassle; or they knew it and felt that they were apart of some elite club, trying to dissuade the noob by telling me all the hard work they did to get to were they are now. And saying that I should stick with my amateur languages because I'm not hardcore enough.

Yeah I think it's unfortunate that many people have a very negative impression and even bias against c++.

Of course, c++ is not for everyone. You need to decide for yourself what your interests and goals are. I dont know what those are, so I cant really tell you that you should or should not learn c++. I can only say that it's not that bad and if you start with a good book then you'll be ok. The way I started was with a single "Intro to C++" class in college that I needed for my major, and that's the only class I ever took. After that I basically just learned from books and programming at home, including writing a software rendering engine and eventually I moved into DirectX.

Avatar image for citizensentry
CitizenSentry

12121

Forum Posts

56760

Wiki Points

0

Followers

Reviews: 0

User Lists: 6

We're focusing on KRYPTON & COBRA at college so I can't really help you sorry.

Avatar image for mysoulz
mysoulz

871

Forum Posts

14

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@chazz85 said:

@mysoulz: I may try it sometime. Lol i don't even know C++ and can't fix this error idk why i came to this thread...

Me either haha. I just came to this thread just because of programming interest in general.

Avatar image for willpayton
willpayton

22502

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

(EDIT) I just watched a the beginning of a beginner tutorial in c++. It does look a bit easier to grasp than last time. I'm gonna give it a shot this weekend. :)

Let us know how it goes.

Avatar image for ilikebigtits
ILikeBigTits

799

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#47  Edited By ILikeBigTits

Side question, for anyone, I plan on switching majors from Accounting to IT, will I need to know much about coding?

Avatar image for mysoulz
mysoulz

871

Forum Posts

14

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

@neonindian: Depends on what field of IT you're going for.

Avatar image for chazz85
Chazz85

5201

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#49  Edited By Chazz85
Avatar image for buttersdaman000
buttersdaman000

23713

Forum Posts

60

Wiki Points

0

Followers

Reviews: 0

User Lists: 0