Search
 
SCRIPT & CODE EXAMPLE
 

CPP

how to take multiple input from user in c++

int a , b;
cin >> a >> b;
Comment

How to take multiple int inputs in the same line in C++

cout << "Enter the values of a and b" << endl;
cin >> a >> b; //cascading the cin operator
Comment

c++ multiple inputs

#include <iostream>
using namespace std;

int main() {
 	int n1, n2;
  	float f1;
  	char c1;
    
    cout<<"Enter two integers, a float and a char: ";
    cin>>n1>>n2>>f1>>c1;	//multiple input in single line
    
    cout<<"Check: "<<n1<<n2<<f1<<c1<<endl;
	return 0;
}
Comment

C++ Taking Multiple Inputs

#include <iostream>
using namespace std;

int main() {
    char a;
    int num;

    cout << "Enter a character and an integer: ";
    cin >> a >> num;

    cout << "Character: " << a << endl;
    cout << "Number: " << num;

    return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ switch case 
Cpp :: c++ class constructor variable arguments 
Cpp :: valid parentheses in cpp 
Cpp :: phi function 
Cpp :: tr bash 
Cpp :: memset function in c++ 
Cpp :: c++ threadpool 
Cpp :: how to modify 2d array in function c++ 
Cpp :: use declaration to define a variable 
Cpp :: quicksort algorithm 
Cpp :: binary to decimal online converter 
Cpp :: inverted triangle c++ 
Cpp :: Programming Languages codechef solution in c++ 
Cpp :: Consell de forces polítiques de Catalunya 
Cpp :: error C2011 
Cpp :: Madiar loh 
Cpp :: arduino bleutooth module hc-05 with led 
Cpp :: scope resulation operator :: in c++ 
Cpp :: #include <iostream #include <stdio.h using namespace std; int main() { int a[5]; a[0]=12; a[1]=13; a[2]=14; a[3]=15; 
Cpp :: const in c++ is same as globle in python 
Cpp :: selection sort algorithm in cpp 
Cpp :: how to make a defaule conrstrocr in c++ classes 
Cpp :: C++ Multilevel Inheritance 
Cpp :: how to fix in c++ "cannot open imgui.h" 
Cpp :: cpp pointer to two dimensional array 
Cpp :: Edmonds-Karp algorithm C++ 
Cpp :: int to string Using boost::lexical_cast 
Cpp :: empty 2d array as a member of a class class c++ 
Cpp :: check if a variable is tring c++ 
Cpp :: __aeabi_assert() 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =