ASDV-WebDev/Semester 3/Assignments/functions/functions.cpp

46 lines
746 B
C++

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/cppFiles/main.cc to edit this template
*/
/*
* File: functions.cpp
* Author: caleb
*
* Created on March 1, 2024, 10:07AM
*/
#include <cstdlib>
#include <iostream>
using namespace std;
#include "functions.h"
int global = 0;
void f1() {
cout << "f1()" << endl;
global++;
f2();
}
void f2() {
cout << "f2()" << endl;
global++;
}
void passByReference(int& x) {
global++;
x = 100;
}
void staticVarFunction() {
static int staticInt = 10;
staticInt++;
cout << staticInt << endl;
}
int& returnReference (int & x) {
x++;
return x;
}