Search
 
SCRIPT & CODE EXAMPLE
 

CPP

how to get input in cpp

// i/o example

#include <iostream>
using namespace std;

int main ()
{
  int i;
  cout << "Please enter an integer value: ";
  cin >> i;
  cout << "The value you entered is " << i;
  return 0;
}
Comment

input in c++

int main(){
  std::string firstname; //variable created as a string
  std::cout << "What's your first name
";
  std::cin >> firstname;//asking for the users' first name
  std:: cout << "Hello " << firstname
Comment

input cpp

#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

how to input in cpp

int x;
cin >> x;
string s;
cin >> s;
Comment

input c++

cin >> variable;

// sample 1
int x;
cout << "x: ";
cin >> x;
cout << x << endl;

//sample 2
int num;
for (int i = 0; i < 10;  i++){
	cout << "Give a number: ";
    cin >> num;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ matrix as argument 
Cpp :: mpi_bcast 
Cpp :: array 2d dynamic allocation c++ 
Cpp :: c++ map iterator 
Cpp :: sort function from bigest to smallest c++ 
Cpp :: C++ convert vector of digits into integer 
Cpp :: check if an element is in a map c++ 
Cpp :: double to string c++ 
Cpp :: c++ array loop 
Cpp :: count occurrences of character in string c++ 
Cpp :: arduino buildin let 
Cpp :: find last occurrence of character in string c++ 
Cpp :: c++ program to find prime number using function 
Cpp :: http.begin not working 
Cpp :: c++ call by value vs call by reference 
Cpp :: c++ 20 struct initialization 
Cpp :: sort vector using marge sorting in c++ 
Cpp :: c++ reading string 
Cpp :: min heap and max heap using priority queue 
Cpp :: c++ initialize multidimensional vector 
Cpp :: string iterator in c++ 
Cpp :: iterate over 2 vectors c++ 
Cpp :: c++ read each char of string 
Cpp :: c++ vector size 
Cpp :: sort index c++ 
Cpp :: how to return char* from function in c++ 
Cpp :: factorial function c++ 
Cpp :: c++ initialize vector of vector with size 
Cpp :: c++ pass array to a function 
Cpp :: currency converter c++ 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =