+ 2
what data type is used to declare data containing both integers and strings (eg gos123.)
6 Answers
+ 8
String itself
for example
#include <iostream>
using namespace std;
int main() {
string name;
cout<<"enter ur username"<<endl;
cin>>name;
cout<<"ur name is "<<name<<endl;
return 0;
}
output
enter ur username
suhailpappu123
ur name is suhailpappu123
+ 4
String data type is used in these cases.
+ 1
string
+ 1
Variable types like int, and float tell the computer that you are dealing with a NUMERIC value. This allows the computer to know that you are assigning a quantity therefore allowing you to do equations. Otherwise, if you treat the number three as a character, the computer will recognize it as a print and not assign any value to it.
+ 1
char data type