| | |
user input into a string
![]() |
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <string> int main() { std::string input; std::cout << "Enter a string: "; if ( getline(std::cin, input) ) { std::cout << "You entered " << input << std::endl; } return 0; }
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
![]() |
Similar Threads
- Tutorial: User Input: Strings and Numbers [C] (C)
- Tutorial: User Input: Strings and Numbers [C++] (C++)
- Handling Invalid User Input? (C)
- Error Checking for user input (Java)
- user input random amount display average. little problem i have run into (Java)
- error checking of user input (C++)
- Creating a GUI that accepts user input help (Java)
- Need Help With Error Checking User Input (C)
- filtering bad user input (Java)
Other Threads in the C++ Forum
- Previous Thread: The definiton of "Memory leaks"
- Next Thread: OOp memory leak error
| Thread Tools | Search this Thread |
api application array based binary bitmap c# c++ c/c++ char class classes code coding compile compression console conversion count cpm delete deploy deque desktop developer dialog directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer introductory java lib linkedlist linkednodes linker loop looping loops map math matrix memory multiple news node numbertoword output parameter pointer problem program programming project python random read recursion reference rpg security sorting string strings temperature template test text text-file tree url variable vector video whyisthiscodecausingsegmentationfault win32 windows winsock wordfrequency wxwidgets






