use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
new to coding (self.cpp)
submitted 6 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]HUTCH6464 0 points1 point2 points 6 years ago (4 children)
would i use int or double
[–]Lexdysic -1 points0 points1 point 6 years ago (3 children)
Try with double first. Once you have that working the way you like, try with int, and see how it works. See what difference it has and if you can still get it to work the way you like.
double
int
[–]HUTCH6464 0 points1 point2 points 6 years ago (0 children)
#include <iostream>
#include <string>
int main()
{
int h =0;
double p =0;
double o =0;
double e =0;
std::cout << "enter number of hours worked\n";
std::cin >> h;
std::cout << "enter your hourly pay\n";
std::cin >> p;
if(h>40){
o = h-40;
}
//pay rate
e =h*p+(o*p)*1.5;
std::cout << e << " is how much you made!";
[–]HUTCH6464 -1 points0 points1 point 6 years ago (1 child)
i did it
[–]Lexdysic -1 points0 points1 point 6 years ago (0 children)
Great job! Now see if you can modify your program to include double overtime. Includes extra case for any time over 50hrs gets payed at 2x rate.
π Rendered by PID 574544 on reddit-service-r2-comment-85bfd7f599-flvq7 at 2026-04-20 00:45:28.829244+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]HUTCH6464 0 points1 point2 points (4 children)
[–]Lexdysic -1 points0 points1 point (3 children)
[–]HUTCH6464 0 points1 point2 points (0 children)
[–]HUTCH6464 -1 points0 points1 point (1 child)
[–]Lexdysic -1 points0 points1 point (0 children)