C++ variables
std::string str = "text"; // stores a string
int foo = 3; // stores any integer
float bar = 3.14; // stores 32 bit number
double baz = 3.14159265; // stores 64 bit number
3.63
8
Value of i : 5
Value of i reference : 5
Value of d : 11.7
Value of d reference : 11.7
Thank you!
8
0
3
1
#include <iostream>
using namespace std;
int main(){
int number = 1;
double decimal = 6.9;
char characterx = 'i';
string text ="Sup";
bool boolean = true;
return 0;
}
Thank you!
1
0
3
4
#include <iostream>
using namespace std
int main{
int x = 3;
float g = 4.0;
long h = 1234567;
double j = 1237886.099;
cout<<x<<endl;
cout<<h<<endl;
cout<<g<<endl;
cout<<j<<endl;
}
Thank you!
4
0
4.67
3
Create a variable called myNum of type int and assign it the value 15:
int myNum = 15;
cout << myNum;
Thank you!
3
0
Are there any code examples left?
New code examples in category Other