C++ Data Types | Practice | GeeksforGeeks

Read a value and store it in the appropriate C++ Data Type. 
Example 1:
Input: 
2 h 2.555
Output:
2
h
2.555 
Explanation:
The three inputs are printed in order.

 
Your Task:
Your task is to complete each of the given functions 
cppIntType() : read an integer input, store it in appropriate data type and return it. 
cppCharType() : read a character input, store it in appropriate data type and return it.  
cppFloatType() : read a float input, store it in appropriate data type and return it. 

Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
 
0
anushavennapoosa20021 month ago
class Solution { public:   int cppIntType() {       // code here       int a;       cin>>a;       return a;   }      char cppCharType() {       // code here       char b;       cin>>b;       return b;   }      float cppFloatType() {       // code here       float c;       cin>>c;       return c;   }}; 
0
0niharika22 months ago
int cppIntType() {       int x;       cin>>x;       return x;   }      char cppCharType() {       char c;       cin>>c;       return c;   }      float cppFloatType() {       float f;       cin>>f;       return f;   }
+3
shivamguptakrm3 months ago
class Solution {
  public:
    int cppIntType() {
        // code here
        int a;
        cin>>a;
        return a;
    }
    
    char cppCharType() {
        // code here
        char b;
        cin>>b;
        return b;
    }
    
    float cppFloatType() {
        // code here
        float c;
        cin>> c;
        return c;
    }
};
+1
aadeshabhigyan093 months ago
class Solution { public:   int cppIntType() {       // code here       int a;       cin >> a;       return a;   }      char cppCharType() {       // code here       char b;       cin >> b;       return b;   }      float cppFloatType() {       // code here       float c;       cin >> c;       return c;   }};
0
gauravverma9918187053 months ago
#include<iostrem>
using namespace std;
int main(){
\\Code Here\\
int a;
string s;
float f;
cin>>a>>b>>c;
cout<<a<<"\n"<<s<<"\n"<<f;
return 0;
0
Yogeshwari Harode11 months ago
Yogeshwari Harode
C++ Data TypesEasiest Codehttps://github.com/yogeshwa...
0
Yogeshwari Harode11 months ago
Yogeshwari Harode
C++ Data Types Very Easy Codehttps://github.com/yogeshwa...
0
Arjun Patidar11 months ago
Arjun Patidar
class Solution {  public:    int cppIntType() {        int a;        cin>>a;        return a;    }
    char cppCharType() {        char b;        cin>>b;        return b;    }
    float cppFloatType() {        float c;        cin>> c;        return c;    }};
0
Shubham Chaudhari1 year ago
Shubham Chaudhari
PLease update the function name.. all functions have the same name and thus causing error in c++
0
Yogeshwari Harode2 years ago
Yogeshwari Harode
https://github.com/yogeshwa...
We strongly recommend solving this problem on your own before viewing its editorial. Do you still
                    want to view the editorial?
 Login to access your submissions. 

Problem


Contest

Reset the IDE using the second button on the top right corner.
Avoid using static/global variables in your code as your code is tested against multiple test cases and these tend to retain their previous values.
Passing the Sample/Custom Test cases does not guarantee the correctness of code. On submission, your code is tested against multiple test cases consisting of all possible corner cases and stress constraints.
You can access the hints to get an idea about what is expected of you as well as the final solution code.
You can view the solutions submitted by other users from the submission tab.