Click here to Skip to main content
15,883,535 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C++
#include<iostream>
using namespace std;

int main()
{
    int a, b;
    cout<<"Enter the Roll_No : ";
    cin>>a;
}


Here, without user enter it manually, have to fill automatically.

is that possible?....

What I have tried:

Any chances for variable fill automatic without user enter manually
Posted
Updated 5-Jan-22 3:38am
v3
Comments
OriginalGriff 5-Jan-22 8:08am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with - we get no other context for your project.
Imagine this: you go for a drive in the country, but you have a problem with the car. You call the garage, say "it broke" and turn off your phone. How long will you be waiting before the garage arrives with the right bits and tools to fix the car given they don't know what make or model it is, who you are, what happened when it all went wrong, or even where you are?

That's what you've done here. So stop typing as little as possible and try explaining things to people who have no way to access your project!

Use the "Improve question" widget to edit your question and provide better information.
Stefan_Lang 5-Jan-22 8:35am    
std::cin reads from console input, and that means the user. That is the whole point of std::cin, so if you want to get input from somewhere else, you should use a different input device, e. g. a file (see std::fstream) or maybe an input data stream from an internet connection.

When you say, 'fill automatic', then what is doing the 'automatic' filling? What is the source? What or who decides how the filling is done?

We can only advise you on doing such a thing if you are more specific on what you have in mind.

1 solution

There is an article present below that can give you a starting point.

Idea is to get keyboard keys as you type in and do whatever you want, however you manually need to check enter and linefeed characters.


I made some getch like functions for you - C++ Forum[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900