Is there any way for cin input in horizontal position?

Viewed 233

Good day! I am trying to solve a simple problem, but couldn't find any solution for it ^^

Is there any way to ask for user input (using 'cin') in a horizontal position?

Like for eg. format... Name Gender Age Civil Status [Input] [Input] [Input] [Input]

enter image description here

I'd tried with a solution only by using this..

#include <iostream>
#include <string>

  int main ()
  {
     std::string name, gender, cvl_stat;
     int age;

   std::cout << "Name";
   std::cout.width(20); std::cout << "Gender";
   std::cout.width(20); std::cout << "Age";
   std::cout.width(20); std::cout << "Civil Status";

   std::cin >> name >> gender >> age >> cvl_stat;

   return 0;

  }

Thank you guys! Keep safe! <3

0 Answers
Related