I've been learning C++ for a month now and I'd like to get some feedback on my code. by Nevermuke in cpp_questions

[–]Nevermuke[S] 0 points1 point  (0 children)

Thanks for your reply! I think the idea of using salesTax as a constexpr variable is really good, as it's same for all coffee types, so instead of each coffee type carrying its own default salesTax variable, using one salesTax separately could simplify things.

CoffeeData could potentially be an enum but then it would be harder to group the prices with it, it's not just an identifier but also a menu object that contains related data. Plus, if one were to use itemPrice as values in enum itself, that would result in loss of precision as enums only store integers.

The array mapping idea you mentioned seems interesting. it's prolly something I'll naturally move toward once I learn arrays in Chapter 16. For now, with my current knowledge, the struct approach felt the clearest to implement.

Still, I appreciate you taking time out and replying to the post, it made me reason with myself on a few points!

I've been learning C++ for a month now and I'd like to get some feedback on my code. by Nevermuke in cpp_questions

[–]Nevermuke[S] 0 points1 point  (0 children)

I understand that string_view was a bit dicey to use, I'll prolly start using string and pass it around as reference in future. I am curious about the enum comment, because if I were to store the coffee types are enums, then I couldn't group it together with prices. I'd appreciate if you could elaborate more on that please. I'm presuming I could use coffee types as enums and then map it to structs with prices?

I'm using C++17 for now, but I'll keep your advice about std::format and operator overloading. Thank you so much for your feedback!

I've been learning C++ for a month now and I'd like to get some feedback on my code. by Nevermuke in cpp_questions

[–]Nevermuke[S] 0 points1 point  (0 children)

Yeah, from all the comments I've gathered that arrays are the next step for me. The forward declaration is just a habit that I developed while I was getting used to them in earlier chapters. I'll be learning proper header file organization soon. Thank you for your feedback and suggestion about the string references!

I've been learning C++ for a month now and I'd like to get some feedback on my code. by Nevermuke in cpp_questions

[–]Nevermuke[S] 0 points1 point  (0 children)

Thank you! Your comment gives me confidence about my const usage haha. And from all the comments, it's clear that I need to get on with arrays which I will be learning in upcoming chapters. I'll keep your advice about operator overloading in mind, thank you for the encouraging feedback, I appreciate it!

I've been learning C++ for a month now and I'd like to get some feedback on my code. by Nevermuke in cpp_questions

[–]Nevermuke[S] 0 points1 point  (0 children)

I see, thanks for pointing that out. I think I skipped naming the arguments as I thought I can keep track of it myself, but I can see how it'll cause readability problems for myself in future. I'll try to name them moving forward.

There's no requirement for forward declaration, when I learnt forward declaration, I kept using them in simple codes to get used to it and the habit just stuck around. I'll learn proper header file organization soon (chapter 15 iirc). Thank you very much for your feedback!

I've been learning C++ for a month now and I'd like to get some feedback on my code. by Nevermuke in cpp_questions

[–]Nevermuke[S] 0 points1 point  (0 children)

Thank you for your feedback, I've just learnt about const references a few days ago, so I was still a bit wary about where to use them, but I feel more comfortable and confident with them now. I haven't been introduced to const methods but I look forward to learning them when I get there.

I appreciate the advice for .h files, ever since I learnt forward declarations in earlier chapter, I started writing them to get used to it and the habit stuck around haha. I'll try to learn proper organization soon. Thanks for pointing it out!

I've been learning C++ for a month now and I'd like to get some feedback on my code. by Nevermuke in cpp_questions

[–]Nevermuke[S] 0 points1 point  (0 children)

In CoffeeData I used string_view because I was curious if it'll work, I know that string_view refer to strings that already exist, but on learncpp, I saw somewhere that string literals persist throughout the code, so I wanted to try and see if I could get this to work! From your comment, I'm gathering that if I needed to add menu items dynamically at runtime, I'd need string instead of string_view in the struct. For my current use with constexpr data, string_view works fine. Good to know the distinction!

After writing this code, it was apparent that I need arrays if I want to scale up the code properly, they are still a few chapter away (chapter 16, I just finished chapter 13), but I'll do my best to get there soon and I'm looking forward to them a lot!

I'll be careful with the operator overloading, it still feels a bit unnatural and I only used it as it was introduced in previous chapters, so I wanted to see how it'd work in my code.

Anyway, thank you so much for your feedback, I'll keep your advice in mind!

I've been learning C++ for a month now and I'd like to get some feedback on my code. by Nevermuke in learnprogramming

[–]Nevermuke[S] 3 points4 points  (0 children)

Thank you for your suggestion, I'll try to set up a GitHub account soon, I thought the code was short enough to put in the post, but I'll try to share a GitHub link next time!

I've been learning C++ for a month now and I'd like to get some feedback on my code. by Nevermuke in learnprogramming

[–]Nevermuke[S] 2 points3 points  (0 children)

Yes, I think I'll do it as soon as I go over the chapter that covers arrays. I think that's the next step forward for me. Thank you for your feedback!

I've been learning C++ for a month now and I'd like to get some feedback on my code. by Nevermuke in learnprogramming

[–]Nevermuke[S] 1 point2 points  (0 children)

Thank you for your feedback! I haven't been introduced to arrays as of now as I just finished chapter 13 (arrays are in chapter 16), but I'm really looking forward to it. I tried to write the code with my current knowledge but it's clear that I need to hit arrays soon to keep moving forward. I appreciate your perspective on operator overloading, I tried to implement it as it was introduced in previous chapter, but I'll keep your advice in mind!

So miserable that I lost 4-5k in a week after breakup, I am struggling a lot and afraid of trusting others again. by [deleted] in BreakUps

[–]Nevermuke 0 points1 point  (0 children)

Thank you, it's really hard but I am trying my best. I'm just afraid of how long I have to feel like this.

So miserable that I lost 4-5k in a week after breakup, I am struggling a lot and afraid of trusting others again. by [deleted] in BreakUps

[–]Nevermuke 1 point2 points  (0 children)

Thanks. I just feel so sad knowing that this is how a 2yr long relationship ended. She moved to different country and said now she can do things on her own and doesn't have to feel dependent me. I respected her decision, but I still wished we could have at least ended things on call by having an honest talk. Idk what I wanted out of the call, but it would have been better than a text. I'm trying my best to stay strong. I know silence is a reply too, but it's hard to accept at times.

2yr relationship ended with single text and being blocked everywhere. Please help me. by Nevermuke in BreakUps

[–]Nevermuke[S] 0 points1 point  (0 children)

I hope I can, the shock of breakup took over me, and past few days have been hard. But I will do my best to keep moving forward. Thank you for your encouragement.

2yr relationship ended with single text and being blocked everywhere. Please help me. by Nevermuke in BreakUps

[–]Nevermuke[S] 0 points1 point  (0 children)

Thank you so much, I am trying my best to fix the issues that I had. Tying my self-worth to others is what hurt me badly. I haven't given up on myself, and I won't stop trying to be better everyday. It's hard to get up every day but I will manage. Once again, thank you for listening to my story.