Skip to main content
Share Your Experience: Take the 2024 Developer Survey

New answers tagged

2 votes
Accepted

Advanced String Calculator with asin, acos, atan Functions in C++

It is inefficient Your code is very inefficient for various reasons. First, StringCalculator itself only handles braces. It finds the innermost braces, then uses <...
G. Sliepen's user avatar
4 votes
Accepted

Advanced String Calculator in C++

Great that you have incorporated all review comments! This is not a complete review (I may get back to it if time permits), but there are two things that caught my eye. The parser: You continue ...
MrBean Bremen's user avatar
3 votes
Accepted

Parsing command-line arguments with getopt in C++

Are the calls to std::exit() justifiable? No. Never use std::exit(). ...
indi's user avatar
  • 11.4k
4 votes

String Calculator in C++

Bug in processing: Power expressions are processed from left to right. 2^3^2 This should be processed as: 2^(3^2) Your code will do it the wrong way: (2^3)^2 But the fix is simple: ...
Martin York's user avatar
  • 95.2k
5 votes
Accepted

String Calculator in C++

A few suggestions (got too long for a comment): don't do the calculation in the constructor, but only when the result is needed (lazily) Do you need a separate method to remove leading and trailing ...
MrBean Bremen's user avatar
4 votes

is_number Function Implementation in C++

isdigit() expects an int that can be represented as an unsigned char or ...
Harith's user avatar
  • 6,822
7 votes
Accepted

is_number Function Implementation in C++

You can make it constexpr You can make both functions constexpr, ensuring you can do compile-time checking of strings for valid ...
G. Sliepen's user avatar
2 votes

Asynchronous web scraping

ascii art # # # HARDCODED # # # MIN_YEAR = 2018 Yes, we can see that about the years, that's why they're following the all caps convention. Please elide the "...
J_H's user avatar
  • 27.5k
2 votes

Advent of Code 2022 Day 13 Solution in C: Sorting and parsing nested list

Separate the list implementation from the main translation unit: Currently, the list can not be used in any other program. Move it to a separate source file and include its corresponding header in the ...
Harith's user avatar
  • 6,822

Top 50 recent answers are included