Skip to content

jasiukiewicztymon/Better-cin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Better cin

Cpp library for inputs with a place holder that may help the user do the cin

#include <iostream>
#include <string>
#include <vector>

#include "cin.h"

int main() {
	std::vector<std::vector<std::string>> templates = { {"cd", "root", "test"}, {"other", "choice"}, {"option", "/s"} };
	std::vector<std::string> template1 = {"cd", "root", "test", "other", "choice", "option", "/s"};
	std::string output;
	bcin(output, " >", templates);
	std::cout << output << std::endl;
	bcin(output, " >", template1);
	std::cout << output;
}

After the first character typed a help is show

image

If the choice is the word you want you can just hit the tabulation button

image

If the choice is not the thing you want type the first letter and it will return a new suggestion

image

Diffrence between 1D array argument and 2D array argument

The 2D array will autocomplete only the numer of word in the text as the length of the array (if the array length is 3 only 3 words will be autocompleted) and it will only autocomplete the first word with the words at index 0 and so on.

The 1D array will autocomplete every word with all the words in the list