C/C++ Program Performance: Validating Entries & Measuring Processing Power

Click For Summary
SUMMARY

The discussion focuses on validating numeric entries in C/C++ using the method `!cin.good()` and clearing the input buffer with `cin.seekg(0); cin.clear();`. Participants highlight the importance of these techniques for robust input handling. Additionally, they emphasize the necessity of using a memory profiler to measure processing power and memory usage, recommending tools like memprof for Linux and a memory profiling tool for Visual Studio 6.

PREREQUISITES
  • Understanding of C/C++ input/output streams
  • Familiarity with error handling in C/C++
  • Knowledge of memory profiling tools
  • Basic concepts of program performance measurement
NEXT STEPS
  • Research the use of `cin.clear()` and `cin.ignore()` for input buffer management in C/C++
  • Explore the capabilities of memprof for memory profiling on Linux
  • Investigate memory profiling tools available in Visual Studio 6
  • Learn about performance measurement techniques in C/C++ applications
USEFUL FOR

C/C++ developers, software engineers focusing on input validation, and anyone interested in optimizing program performance and memory usage.

Hypercase
Messages
63
Reaction score
0
I,m writting code in C/C++ and when i validate my enteries(ensure they are numeric) i use !cin.good().

Also how do i clear the buffer after an invalid entry?
I usually use cin.seekg(0);cin.clear(); How do they work?
Is there a better way?

How do i find out how much processing power and memmory my prog uses as it runs?

-01000011 01101000 01100101 01100101 01110010 01110011.
 
Computer science news on Phys.org
You need what is called a memory profiler. I know under linux there is memprof and under visual studios 6 I think the program is called spy or something or other (Don't quote me on this).
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
Replies
14
Views
2K
Replies
3
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 15 ·
Replies
15
Views
4K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 2 ·
Replies
2
Views
11K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
6K