Files
UTEC-Lic_ME_2024_2025/UTC502/24-10-17/exercice8.cpp
T
Guillaume-Sanchez ff4bb12d22 initial commit
2026-05-26 13:56:03 +02:00

33 lines
565 B
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
Énoncé
Écrire une fonction permettant dajouter une valeur fournie en argument à une variable fournie également en argument. Par exemple, lappel (n et p étant entiers) :
ajouter (2*p+1, n) ;
ajoutera la valeur de lexpression 2*p+1 à la variable n.
Écrire un petit programme de test de la fonction.
*/
#include <iostream>
using namespace std;
// Function declaration
void ajouter(int p, int n);
int main(){
ajouter(2*3+1, 2);
}
// Fonction definition
void ajouter(int p, int n){
int toto = p + n;
cout << toto << "\n";
}