Let's begin:
C++ has many datasets like char, float, int and string etc. Here provided the complete code:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream>//Header File | |
int main()//Main Function | |
{ | |
char a; //Declairing a variable (a) which is a character (char) | |
std::cin>>a; //Taking input (std::cin) and saving the value (>>) in variable (a) | |
std::cout<<a; //Printing (std::cout) the value (<<) of variable (a) | |
return 0; //To terminate the program after sucessful completion | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> //Header File | |
int main() //Main Function | |
{ | |
float a; //Declairing a variable (a) which is a float | |
std::cin>>a; //Taking input (std::cin) and saving the value (>>) in variable (a) | |
std::cout<<a; //Printing (std::cout) the value (<<) of variable (a) | |
return 0; //To terminate the program after sucessful completion | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> //Header File | |
int main() //Main Function | |
{ | |
int a; //Declairing a variable (a) which is an integer (int) | |
std::cin>>a; //Taking input (std::cin) and saving the value (>>) in variable (a) | |
std::cout<<a; //Printing (std::cout) the value (<<) of variable (a) | |
return 0; //To terminate the program after sucessful completion | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> //Header File | |
int main() //Main Function | |
{ | |
char a[20]; //Declairing a variable (a) which is a character (char) upto 20 value | |
std::cin>>a; //Taking input (std::cin) and saving the value (>>) in variable (a) | |
std::cout<<a; //Printing (std::cout) the value (<<) of variable (a) | |
return 0; //To terminate the program after sucessful completion | |
} |
Comments
Post a Comment