c++ beginner s3-function

function

// main.cpp
#include <iostream>
#include "utils.h"
using namespace std;

int main() {

    greeting();
    int result = plue_one(1);
    cout << result << endl;

    return 0;
}

void greeting() {
    cout << "Hello" << endl;
}

int plue_one(int num) {
    num++;
    return num;
}

header

// utils.h
#ifndef UTILS_H_
#define UTILS_H_

void greeting();
int plue_one(int num);

#endif /* UTILS_H_ */

Last updated

Was this helpful?