answersLogoWhite

0


Best Answer

To prompt a user in C++ you use cout to output the prompt to the console (e.g., the screen). You then use cin to extract the input from the user. So to get user input without a prompt, simply do not output a prompt before accepting input. However, accepting user input without a prompt would be decidedly un-user-friendly, unless you can guarantee the input does not come from the keyboard.

If you're not using the console and the program is actually running in an event-driven interface (such as Windows), then you need only trap the keyboard, mouse or other HID messages that are posted to your application via the application's message loop, and act accordingly.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C plus plus get user input without prompting for it?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

A program that uses prompting messages to direct the user's input is running in?

Interactive mode


What is the meaning of print and input in idle python?

"print" will output a value onto the screen for a user to see. "input" or "raw_input" gets a user's input.


What are input processes for the Currency Conversion project?

It really depends where are you inputs coming from.From the keyboard by prompting the user: import java.util.Scanner;System.out.print("input: ");Scanner scan = new Scanner(System.in);int input = scan.nextInt();// Do your converting with the inputFrom a file: import java.io.FileReader;import java.util.Scanner;Scanner scan = new Scanner(new FileReader("inputFile.dat"); // the input data fileint input = scan.nextInt(); //similar to reading from keyboard since the file is now your input source//Do your convertingscan.close(); // remember to close your files that you opened, good Java conventions


C program to display a number entered by user as it is without skipping the zeros preceding the number?

// Define and initialize input buffer char inputBuffer[256]; memset(inputBuffer, '\0', 256); // Get input scanf("%s", inputBuffer); // Display exactly what the user typed in printf("%s\n", inputBuffer);


How do you write a c plus plus program to display n congratulatory messages where n is a user input value?

#include<iostream> #include<sstream> int main() { unsigned num; while (true) { std::cout << "Enter a number: "; std::string input; std::cin >> input; std::stringstream ss; ss << input; if (ss>>num) break; std::cerr << "Invalid input.\n"; } for (int i=0; i<num; ++i) std::cout << "Well done!\n"; }

Related questions

A program that uses prompting messages to direct the user's input is running in?

Interactive mode


How do you check a user's text input in C plus plus?

Use an SLR parser algorithm.


What is ment by software?

Software is basically a program or series of programs written in code that tells the computer what to do. Most of the software that you visualize on your monitor often times asks the user for input in order to tell the computer what the user wants it to do. A lot of software runs in the "background" without the user having to input anything and usually without the user even knowing that it is there.


What is the problem with floating inputs?

The problem with floating inputs is that electrical noise in the line could trigger the input without user input. This can easily be avoided with a pull-up or pull-down resistor. The problem with floating inputs is that electrical noise in the line could trigger the input without user input. This can easily be avoided with a pull-up or pull-down resistor.


What is the meaning of print and input in idle python?

"print" will output a value onto the screen for a user to see. "input" or "raw_input" gets a user's input.


Why validate user input?

To insure that the users input is valid.


What is stimuli in computer science?

it is an input from a user from the real world(a real world input) that is input from either sensors or user input data to a real time application or any other type of applications.


How do you see if my husband has 2 factor authentication turned on without me having his phone?

You can't... The security protocol requires the authorised user to input a PIN - which obviously only the user should know.


What are input processes for the Currency Conversion project?

It really depends where are you inputs coming from.From the keyboard by prompting the user: import java.util.Scanner;System.out.print("input: ");Scanner scan = new Scanner(System.in);int input = scan.nextInt();// Do your converting with the inputFrom a file: import java.io.FileReader;import java.util.Scanner;Scanner scan = new Scanner(new FileReader("inputFile.dat"); // the input data fileint input = scan.nextInt(); //similar to reading from keyboard since the file is now your input source//Do your convertingscan.close(); // remember to close your files that you opened, good Java conventions


Does input include user responses?

yes it does.


Why are storage devices are output and input?

the input device get input from user.. output device display the result....


What is the definition for an input and output machine?

An input device is a device which is used by the user to enter data into the computer system. An output device is a device which is used by the computer to send data back to the user in a way that the user can understand. It is possible for a device to be both an input and output device simultaneously. For example a force-feedback joystick takes input from the user, but also communicates to the user with a series of vibrations or force-actions.