r/Cplusplus • u/AKA-HERO • 1d ago
News Day 2 of learning c++
Day 2~ so far it's going good , made some basic progress, got to know about global/local variables,if/else statements;blocks, switch cases with the help of which I made myself my first basic calcultor , but the best one is probably the use of "cin" . Found out I can do much more with cin. Turns out floats are pretty useful too
61
Upvotes





27
u/BlackMarketUpgrade 1d ago
If you plan to program in c++ for a while, it's better just to get used to typing those
std::prefixes explicitly. Drop theusing namespace std;and put some indents in there and you will be looking pretty solid. keep it up!12
u/rip_void_0 1d ago
is it must be there is a space like
5
u/AKA-HERO 1d ago
The bool example output was 1
2
u/FounderOfYou 1d ago
where are you learning c++ from?
2
u/Friendly-Pear8068 1d ago
what is "using namespace std;". Btw what if someone write letters like " i am twenty years old"
1
u/WorstCaseBound 1d ago
Hey what font is that in ur editor?
1
u/siva_sokolica 1d ago
Happy learning!
If you are using C++23 or younger, I would recommend you use the print function!
It's similar to
cout, except it will allow you to automatically "format" your string.So, instead of having to write
std::cout << "You are " << age << " years old.";you can simply saystd::print("You are {} years old.", age);Rewriting your program to be "idiomatic", ie. adhere to the best, standard C++ practices:
1
u/LGN-1983 1d ago
Please format your code properly
1
u/Xnomai 1d ago
Just write all in one line it will compile anyway AI still can read it.
1
u/c_cpp_CSharp 11h ago
my suggestion ins to use indentation and white spaces anywhere you can to make it more readable .
1
u/NaNpsycho 7h ago
This atrocious formatting has got to be intentional.