Files
Guillaume-Sanchez ff4bb12d22 initial commit
2026-05-26 13:56:03 +02:00

44 lines
810 B
C++
Raw Permalink 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, sans argument ni valeur de retour, qui se contente dafficher, à chaque appel, le nombre total de fois où elle a été appelée sous la forme :
appel numéro 3
*/
#include <iostream>
using namespace std;
// variable globale
int count = 0;
// Function declaration
void fonction1();
int main(){
char input;
cout<<"Voulez vous appeler la fonction ? o/n : "; cin>>input;
while (input == 'o')
{
fonction1();
cout<<"Voulez vous de nouveau appeler la fonction ? o/n : "; cin>>input;
}
std::cout << "Vous avez tapez autre chose que 'o', Fin du programe \n" << std::ends;
return 0;
}
// Fonction definition
void fonction1(){
::count = ::count +1;
std::cout << "appel numéro " << ::count << "\n" << std::ends;
}