First commit
This commit is contained in:
BIN
IUT/Info1/TD/Exercices/pointeur1/fonction
Normal file
BIN
IUT/Info1/TD/Exercices/pointeur1/fonction
Normal file
Binary file not shown.
11
IUT/Info1/TD/Exercices/pointeur1/fonction.cpp
Normal file
11
IUT/Info1/TD/Exercices/pointeur1/fonction.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "fonction.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
void Affiche_réels(const float* p_f, unsigned int nb) {
|
||||
for (unsigned int i = 0; i < nb; i++) {
|
||||
cout << *p_f << endl;
|
||||
};
|
||||
}
|
||||
1
IUT/Info1/TD/Exercices/pointeur1/fonction.h
Normal file
1
IUT/Info1/TD/Exercices/pointeur1/fonction.h
Normal file
@@ -0,0 +1 @@
|
||||
void Affiche_réels(const float* p_f, unsigned int nb);
|
||||
BIN
IUT/Info1/TD/Exercices/pointeur1/main
Normal file
BIN
IUT/Info1/TD/Exercices/pointeur1/main
Normal file
Binary file not shown.
22
IUT/Info1/TD/Exercices/pointeur1/main.cpp
Normal file
22
IUT/Info1/TD/Exercices/pointeur1/main.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "fonction.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
|
||||
unsigned int n;
|
||||
cout << "Saisir le nombre de réels à stocker" << endl;
|
||||
cin >> n;
|
||||
|
||||
float* p = new float[n];
|
||||
|
||||
for (unsigned int i = 0; i < n; i++) {
|
||||
*(p+i) = i;
|
||||
}
|
||||
|
||||
Affiche_réels(p, n);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user