RehabReda 0 Light Poster

hi guys
really i can't understand anything about them
i want to store a variable in memory so i can use them again with any function at any time how can i do this please if anyone know please help
i want to make a program like this in prolog
this in c++

#include<iostream> 
using namespace std; 
int x=10; 
string s="blabla" 
int z=30; 
void printX() 
{ 
z++; 
cout<<x<<endl; 
cout<<s<<endl; 
} 
int main() 
{ 
printX(); 
}