C++ variables code example
Example 1: declare variable c++
#include <iostream>
using namespace std;
int main(){
int numero;
}
Example 2: C++ Variable
#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;
}
Example 3: c++ declare variable
std::string str = "text";
int foo = 3;
float bar = 3.14;
double baz = 3.14159265;
Example 4: variabvles in c++
#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;
}
Example 5: C++ variables
Create a variable called myNum of type int and assign it the value 15:
int myNum = 15;
cout << myNum;
Example 6: reference variablesr in c++
Value of i : 5
Value of i reference : 5
Value of d : 11.7
Value of d reference : 11.7