Troubleshooting C++ Program: Understanding usrStr and userInput Functions

  • Context: C/C++ 
  • Thread starter Thread starter elmessican
  • Start date Start date
  • Tags Tags
    C++ Program
Click For Summary
SUMMARY

The discussion focuses on troubleshooting the "usrStr" and "userInput" functions in a C++ program. The user identifies an issue where the "OutputWithoutWhiteSpace(userInput)" function operates correctly but inadvertently adds extra characters to the output. Specifically, the user notes that the function returns a string that includes whitespace characters that should have been removed, leading to confusion in the output. The conversation emphasizes the need for proper function implementation to ensure accurate string manipulation.

PREREQUISITES
  • Understanding of C++ string manipulation techniques
  • Familiarity with function definitions and calls in C++
  • Knowledge of whitespace handling in strings
  • Experience with debugging C++ code
NEXT STEPS
  • Review C++ string functions such as "std::string::erase" and "std::remove_if"
  • Learn about C++ debugging techniques to identify function output issues
  • Explore best practices for handling user input in C++
  • Investigate the use of regular expressions in C++ for string manipulation
USEFUL FOR

C++ developers, software engineers, and anyone involved in string processing and debugging in C++ applications.

elmessican
Messages
6
Reaction score
0
I'm having trouble understanding how to use the "usrStr" or how to use the userInput in both of my functions. I know the problem with my code, i see that when i call the OutputWithoutWhiteSpace(userInput) function it works fine but it adds the extra characters

first sentence = 46 characters
then when i call the withoutspaces fuction it adds the whitespaces eliminated to the result
 
Technology news on Phys.org
Hi, and welcome to the forum!

Could you post the code you are talking about? Please wrap it in the [CODE]...[/CODE] tags.
 

Similar threads

  • · Replies 14 ·
Replies
14
Views
34K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 5 ·
Replies
5
Views
7K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 40 ·
2
Replies
40
Views
3K