Disappointed

Pages: 123
I am greatly disappointed with Visual Studio and C++. 25 years ago I took a course in college and didn't not have the kinds of problems I am having now. With Visual Studio everything I do comes up with errors. It is aggravating.
I have learned PHP from books, and had very few problems with it. Why is it so difficult to learn C++.
By the way I tried to learn Python and gave up because there was formatting and no one said anything about it so I dropped learning Python.
Is my problem with the code the ide or something else?

I also went to the website someone suggested and even there there is problems with the code.
Last edited on
Hello mathman54,

I have been using VS2015 and VS2017 for about 6 years without any real problems. Part is learning C++, including the formatting parts, and learning VS.

It is easy to say that you are disappointed and having problems, but show some code that you are having problems with.

There is a good chance that the problems lies in your code not the IDE.

With any language learning the syntax and how the language needs to be formatted is the first step.

Start with posting the offending code and the complete error message(s) the IDE generates.

After it could possibly something in the installation of the IDE.

Andy
What resources are you learning from? I ask, because if your having issues in Visual Studio AND on those online compile-and-run websites, chances are the real issue lies with one of the following:

* The resources you're learning from, OR
* You have a tendency to try and rush things, basically throwing yourself at a wall.

Given https://cplusplus.com/forum/beginner/273506/ I'm inclined to think it's the latter, but it could be that you're not learning from a well-designed textbook/tutorial/etc and are trying to do things despite not knowing how to do them correctly. Programming in general is not friendly to that approach. Hence why I ask.

One final note: Python's formatting requirements usually aren't the biggest issue if you're doing what you should already be doing, which is indenting your code (and making sure the indent style matches the rest of the file).

-Albatross
@mathman
In the unlikely event that you are not just taking the piss, I can fully empathise because nobody so far has told you that you are the ‘something else’. Subconsciously your body/mind is telling you through your whining that you just aren’t cutout to do programming.
c++ is a large, difficult language. Python though is dead simple, new coders and total novices code in it all day long. Yes, it has that exceedingly stupid throwback of using indentation instead of symbols to make code blocks, but that is its only really odd feature. Most of the rest of it is straight forward enough. I don't like it because its terribly slow unless you get off into the sidegrades of it ... cython and scithon and whatever else they have now -- which were created to address the horrid problems of the original language -- counter some of the issues but all in all, I am not too keen on it.

A book I had 20 years ago put it this way: if you can't get it going, its almost always you, not the tools. There are enough mature tools out there for established languages. Certainly visual is one of the best.

But it takes time. The idea, put out by get rich quick companies, that you can learn c++ in 30 days etc, is BS. It takes a few years for c++. Python and other simpler languages, a few months if you already know how to code. But coding itself takes time to learn too, no matter what languages, it takes 1-2 years to get the general ideas down well enough to do anything more interesting than classroom assignments, and here again, probably 5+ years before you can design good systems and larger things correctly.
Last edited on
I guess from the pink coloration we have embarrassment from being told the truth has set in. As if Microsoft will ever recover from such a fatuous claim that they haven’t got VS at least roughly right.

I wonder what the next homespun platitudes in the name of help will be.

Instead it would have been better for you, @mothman, to save face and say ‘Yeah, I was just joking’ instead of prolonging the whine.
Actually, I reported you because the content of your message has no place on a forum where novices go to receive constructive criticism.

-Albatross
Albatross I was learning Python several years ago when formatting was necessary. I gave it up and have no plans to go back.

Albatross: Here are a couple of titles that I have to learn from, Learn c++ quickly. I type in to vs the code in the book and get all kinds of errors. Reading the errors is not very clear.
Hands on C++ animation programming. Programming C++ game programming.

I type in the code from the book click the debugger and up pops the errors.

jonnin: I learned php is days. I was ambitious. Very few problems. C++ should not be that difficult. From the two different types of double quotes to just so much garbage .

Handy, I don't really think that it is vs but I do think that the problem is with the code.

Like I said, I learned how to program C++ in college on a Unix machine. Not very difficult at all.
Last edited on
Smart quotes: The hidden scourge of text meant for computer consumption
https://devblogs.microsoft.com/oldnewthing/20090225-00/?p=19033

PHP would break in pretty much the same way as Python or C++ if you used special unicode quote characters instead of just "". Without making this a repeat of the last thread, suffice to say something is wrong with your text editing environment to even let the fancy stylized quotes be used.

If Visual Studio is annoying you, you can always just type in Notepad++ or other simpler text editors instead. https://notepad-plus-plus.org/downloads/v7.8.8/

_________________________

If you want to avoid Visual Studio altogether, you can download Windows versions of GCC (MinGW).
https://nuwen.net/mingw.html
Once you set that up, you can compile a simple hello world program like:
g++ -Wall hello.cpp -o hello
Last edited on
Hello mathman54,

Looking at the link that Albatross posted I can see why you are having problems. I put some comments in the code I found there:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include pch.h  // <--- Missing the double quotes.
#include <iostream>
#include math.h  // <--- Missing the double quotes. And you should use (cmath).

all of the includes have squiggly lines  // <--- Needs to start with // to make it a comment

using namespace std;  // <--- Should be avoided, but if you insist find out the hard way.

int main()
{
    float temp_f{}, temp_c{};

    cout << “Enter temperature in Fahrenheit” << endl; Enter temperature has squiggly lines.  // <--- Wrong type of double quotes. A comment should start with //.

        cin >> temp_f;

    temp_c = (temp_f – 32) * (5.0 / 9.0);  // <--- Something may be wrong with the minus sign that you used. I had to delete it and retype it.

    cout << “The temperature in Celsius is” << temp_c << :\n”; The temperature has the same problem //< --- Wrong type of double quotes.
        // <--- The last part (:\n") should be ('\n'). That may have bee just a typo.
}

#include "pch.h" . This is created by the VS wizard and not able to be used by everyone. If this is the way that you want to create program solutions that is fine, but leave this line out of your posts to avoid comments about why it should not be there. Also notice that this is in simple double quotes that came from the keyboard. Not the fancy ones that you used which the compiler does not understand.

Line 2 is the correct way to include a header file.

Line 3 should be in <> and you should use "cmath", the C++ version, over "math.h", the C version.

Line 5 should be a comment although I get what you meant it should either start with (//) for a line comment or (/* */) for a block comment. A line comment is considered everything from the 2 forward slashes until you press enter even if it should span 2 or more lines.

In line 11 prefer using "double" over "float". "float" does not store some decimal numbers well and being small than a "double" can really be far off in the number it stores. What is on the left side of the decimal point is not a problem.

In lines 13 and 19 your fancy double quotes may look nice, but the compiler does not understand the value of that character. It is looking for (") or ASCII code 34 decimal or 22 hex. What you are using (“) comes up as ASCII code 147 decimal or 93 hex. A big difference.

Not sure how you came up with using (“) over ("). The angle is small, but make a big difference.

In line 19 at the end you have (:\n") . I think this is just a type and you meant to use ("). Even though the (\n) may appear to be 2 characters it is considered 1 character and single quotes are sufficient for this.

After changing you code it now looks like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//#include "pch.h"
#include <iostream>
#include <cmath>

//all of the includes have squiggly lines

//using namespace std;  // <--- Should be avoided, but if you insist find out the hard way.

int main()
{
    double temp_f{}, temp_c{};

    std::cout << "Enter temperature in Fahrenheit: "; //Enter temperature has squiggly lines.  <--- Wrong type of double quotes.

    std::cin >> temp_f;

    temp_c = (temp_f - 32) * (5.0 / 9.0);

    std::cout << "\nThe temperature in Celsius is: " << temp_c << '\n'; //The temperature has the same problem  <--- Wrong type of double quotes.

    return 0;  // <--- Not required, but makes a good break point.
}

With the changes I made this code compiles wit no errors or warnings and runs just fine.

With what I just found and read I do not think it is the code you are entering, but the way and what you are using.

Andy

Edit: typos.
Last edited on
jonnin: I learned php is days. I was ambitious. Very few problems. C++ should not be that difficult. From the two different types of double quotes to just so much garbage .


? there is only one type of double quotes in c++.
Well, if you think c++ has too much garbage, you are in LUCK. There are close to 50 languages that are really watered down c++ --- from java to ruby to pascal. Pick the one that removes the features you do not like, and use that one instead. It is why they exist; they were invented by people who do not care about performance or rich capability at the cost of having to learn something. Or just learn the bits of c++ that you need as you need them; you don't need to know everything to write programs. Ive used it for over 30 years and there is plenty of details that I don't know, as the experts here are oft happy to point out when I forget something. That does not offend me -- I learn as much as I give on here -- but that puts it in scope for you. Its not the easy path.

Should it be easier to learn? Probably. But the only real way to do that is to gut the language so that it has less features. They already did that with those other languages. It is easier than it was. Arguably everything since 2011, have been geared toward making it easier to do more with less.

Maybe try java or pound c. My brother in law is taking a graduate level java course and I have been able to help him fix his code and teach him. He has no coding experience at all, and to write java, I have to google every other command (I know next to zero beyond loops and booleans and that it needs extra classes). Its easy, once you get past the 'you can't do that' stuff that they stripped out. The environment is challenging -- the slightest thing in your config wrong causes no end of trouble -- but the language itself is not at all difficult. Even better, the syntax is similar enough to c++ that you could come back after and be ahead of the game next time you tried it.
Last edited on
Whine, moan, whinge. But nobody has told me how to use Notepad++

Part of the thrill of C++ and IDE’s is to have races to see how many errors you can get compared to the rest of the class. About 1600 is a record I have seen. Of course most collapse on the first line corrected.

The point being, it is part of being alive to handle errors and climbing steep learning curves. Let’s face it just imagine the learning curve for a real discipline. No time to whine and moan there.
mathman54 I'm very much in the same shoes as you. I use to do some coding in C++ 20 some years ago, but where I worked they used Visual Basic, so I stopped playing with C++. Over the years I started solving small problems with perl. Then last year I had a problem that was too complex to solve with perl, I personally don't think perl is useful for programs more than a couple of hundred lines.

It took me three days of work, and I realized that I had forgotten how to code in C++. So recently I've been coding in C++ everyday, if I have a problem that I would have solved in the past with perl, I now do it in C++. Yes it always takes me longer.

That said, what you learned 20 years ago is still valid, and I'm using the exact same tools that I used 20 years ago. If your IDE is giving you problems, switch so another editor and compile with nmake.

I personally use CMake on my windows machine to create a nmake file, because I find the VS IDE frustrating also.
Last edited on
It worked!

jonnin: my learning c++ has a purpose. I want to use this for a project I have in mind.

Gonado: How am I supposed to know that there are hidden special characters. Especially if the books I am reading don't tell me that they exist.
I have two Packt books they suck. The publisher hides any information about contacting the authors, making it very difficult to learn the language.
A search for "Learn C++ Quickly" yields this book: https://www.amazon.com/gp/product/B08DZ3NY6Z
I took a look at the preview and… I strongly suggest that you find a new book. This book teaches misinformation. https://learncpp.com might actually be a better resource. Otherwise, Principles And Practice Using C++ 2nd Edition and C++ Primer 5th Edition are getting somewhat old, but they're still new enough to be relevant. They're not cheap, but they are good books.

Hands On C++ Animation Programming and C++ Game Programming sound like more advanced books that assume that you already have some prior experience.

@wilson59
I feel it's worth pointing out that C++ has changed a lot in 20 years, as have the tools you're probably using to program in it (unless you're literally using the exact same versions of the exact same tools, in which case please update). Importantly, best practices have also changed, for instance:

★ A few C++98 classes have been removed as of C++17 (notably: std::auto_ptr).
★ The standard library has enlarged, in some cases providing functionality that you'd previously have to use the C libraries for.
★ Range-based for loops in many places where traditional for loops (especially w/ iterators) would be used instead.

-Albatross
It worked!
What worked?

If you are copying text from an e-book, you should avoid doing that. Always type the characters yourself inside Visual Studio itself or another text editor like Notepad++.

How am I supposed to know that there are hidden special characters.
Not hidden characters (usually), just different ones. I didn't say you should know. But now we're talking about it, so now you know. The quotes that you type in while using a text editor like Visual Studio's will not produce fancy quote marks. Other applications like Word or some website formats will produce these fancy quote marks, so when in doubt, always type it yourself.

You can see there is a slight, but physical difference between
’ and '
“ and ” and "
Last edited on
Actually, I reported you because the content of your message has no place on a forum where novices go to receive constructive criticism.
You really think your cancel culture mentality counts for anything? Wasting your time on moaners with lame homilies is demeaning. @OP is simply declaring his/her intellectual laziness. None of the rubbish being written here is constructive, and yes that includes mine. But look at yourselves eagerly crawling out of the woodwork to feed this dope who can’t scratch without assistance.
I want to start by saying that if you guys don't mind I will come here with my queries and hope for answers like I have been getting.
Ganado I was talking about the program that was edited by Handy Andy.
I am starting to get motivated again.
I am not using an ebook, paperbacks.
My question is how do I get these slightly different symbols? I know how to do this one "" .

Albatross: Hands on C++ animation programming and C++ game programming are beginners books.
I should not have bought the Learn C++ quickly there is nothing on their website to help those who have purchased the book.
wilson 59 I found perl to be like COBOL. Too much code to write. I am using Visual Studio for 2 reasons, first I paid for it, and I want to do windows programs without the headache. And yet every program I write is a headache.
Why did you buy Visual Studio? I'm genuinely asking, because I don't even know if there's any difference between Community and Pro, and I've been using various versions of both for years. So I don't know why a complete beginner would decide to buy it, especially since (I imagine) it's not cheap.
Pages: 123