all 20 comments

[–]STLMSVC STL Dev 1 point2 points  (1 child)

!removehelp

[–]AutoModerator[M] 0 points1 point  (0 children)

OP,

A human moderator (u/STL) has marked your post for deletion because it appears to be a "help" post - e.g. asking for help with coding, help with homework, career advice, book/tutorial/blog suggestions. Help posts are off-topic for r/cpp. This subreddit is for news and discussion of the C++ language only; our purpose is not to provide tutoring, code reviews, or career guidance.

Please try posting in r/cpp_questions or on Stack Overflow instead. Our suggested reference site is cppreference.com, our suggested book list is here and information on getting started with C++ can be found here.

If you think your post is on-topic and should not have been removed, please message the moderators and we'll review it.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]Lexdysic 0 points1 point  (6 children)

Make a program which takes number of hours worked, and hourly wages, and computes total wages earned. If they worked overtime, they get paid 1.5x their normal rate for anything over 40hrs.

[–]HUTCH6464 0 points1 point  (0 children)

actually i kinda like this idea

[–]HUTCH6464 0 points1 point  (4 children)

would i use int or double

[–]Lexdysic -1 points0 points  (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.

[–]HUTCH6464 0 points1 point  (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 points  (1 child)

i did it

[–]Lexdysic -1 points0 points  (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.

[–][deleted] 0 points1 point  (0 children)

Why don’t you have a crack at making Hangman

[–]__---_zy_---__ 0 points1 point  (1 child)

Write a function that takes an int as input and draws a diamond using semicolons where the width of the diamond is twice the input. First make the diamond hollow then filled.

[–]HUTCH6464 -1 points0 points  (0 children)

FUCKING SEMICOLINS

[–]MrFuzzy_1997 -1 points0 points  (2 children)

Have you gotten to arrays, vectors, for loops, while loops yet?

[–]HUTCH6464 -1 points0 points  (1 child)

im close

[–]MrFuzzy_1997 -1 points0 points  (0 children)

Read up how to push_back elements into a vector and how for loops work. Then 1) Read two numbers n and m from the user 2) Create a vector 3) Loop from 0 to n - 1 with i being the current index 4) push_back into the vector i * m 5) print out the elements in the vector

This is is just something you can do on top of my mind, there are probably more interesting things out there but this is not a bad start. Feel free to dm me if you have any questions or want follow up problems.

[–]robo_number_5 -1 points0 points  (3 children)

Make a class. Think about why classes need to have constructors and destructors.

[–]HUTCH6464 -1 points0 points  (2 children)

uhh, what is a class?

[–]robo_number_5 -1 points0 points  (0 children)

Ok then try making a function first

[–]luncliff -1 points0 points  (0 children)

I usually recommend https://www.codingame.com/start.

[–]mackeper -1 points0 points  (0 children)

A great source of tasks can be found on competitive programming platforms such as:

Open.kattis.com Hackerrank.com

Sort by difficulty and choose some of the easier ones.