best way input a char

what is the best way to input a char if i want to take multiple inputs separated by a space after each variable and press enter only once after i have entered all the variables…scanf doesnot work properly…i am not supposed to use getch() or getche() either.
please suggest another way…

Just an example…

#include <cstdio>
#include <vector>

using namespace std;

int main() {
	char c;
	vector<char> v;
	while ( (c = getchar()) != '\n') {
		v.push_back( c );
	for ( int i = 0; i < v.size(); ++i ) {
		printf( "%d - '%c'\n", i, v[i] );
	return 0;
1 Like

What is the problem with scanf? And why you cannot use getc? What about getline?

how can i use getc??

see the answer below (getc is for stream, for stdin I used getchar, but principle it is the same)…

can u convert the code in c and tell me…