#include <iostream>
using namespace std;
void showVar(); // Function prototype
int main()
{ for (int count = 0; count < 10; count++)
showVar();
return 0;
}
// Definition of function showVar
void showVar()
{ static int var = 10;
cout << var << endl;
var++;
}
i dont have anything to run these at home so thanks if anyone can :)
// code 2
#include <iostream>
using namespace std;
void myFunc(); // Function prototype
int main()
{ int var = 100;
cout << var << endl;
myFunc();
cout << var << endl;
return 0;
}
// Definition of function myFunc
void myFunc()
{ int var = 50;
cout << var << endl;
}