declaration variable c++ code example

Example 1: declare variable c++

#include <iostream>
using namespace std;

int main(){
   	int numero; //il tipo della variabile è int, il nome della variabile è 'numero'
}

Example 2: c++ declare variable

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

Example 3: C++ variables

Create a variable called myNum of type int and assign it the value 15:
  int myNum = 15;
cout << myNum;

Example 4: 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;
}

Tags:

Misc Example