can someone run these codes for me and put the output here please? thanks!

#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;
}
Last edited on
Can you use a browser? https://ideone.com/
code1:
10
11
12
13
14
15
16
17
18
19
code2:
100
50
100
Topic archived. No new replies allowed.