TP0: added part 1
This commit is contained in:
parent
ca7bb3a8dd
commit
fa69f35b4c
2 changed files with 79 additions and 0 deletions
37
tp0/p1/main.cpp
Executable file
37
tp0/p1/main.cpp
Executable file
|
@ -0,0 +1,37 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
void remplitA(int tab[]);
|
||||||
|
void afficheA(int tab[]);
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int a[10];
|
||||||
|
int &refA5 = a[5];
|
||||||
|
int *pointA7 = &a[7];
|
||||||
|
remplitA(a);
|
||||||
|
//refA5 ++;
|
||||||
|
pointA7 = pointA7-2;
|
||||||
|
(*pointA7) ++;
|
||||||
|
afficheA(a);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void remplitA(int tab[])
|
||||||
|
{
|
||||||
|
for(int i=0 ; i<10 ; i++)
|
||||||
|
{
|
||||||
|
cout << "A [" << i << "] :";
|
||||||
|
cin >> tab[i];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
void afficheA(int tab[])
|
||||||
|
{
|
||||||
|
cout << "Valeurs de A :" << endl;
|
||||||
|
for(int i=0 ; i<10 ; i++)
|
||||||
|
{
|
||||||
|
cout << tab[i] << ", ";
|
||||||
|
}
|
||||||
|
cout << endl;
|
||||||
|
};
|
42
tp0/p1/p1.cbp
Executable file
42
tp0/p1/p1.cbp
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||||
|
<CodeBlocks_project_file>
|
||||||
|
<FileVersion major="1" minor="6" />
|
||||||
|
<Project>
|
||||||
|
<Option title="p1" />
|
||||||
|
<Option pch_mode="2" />
|
||||||
|
<Option compiler="gcc" />
|
||||||
|
<Build>
|
||||||
|
<Target title="Debug">
|
||||||
|
<Option output="bin/Debug/p1" prefix_auto="1" extension_auto="1" />
|
||||||
|
<Option object_output="obj/Debug/" />
|
||||||
|
<Option type="1" />
|
||||||
|
<Option compiler="gcc" />
|
||||||
|
<Compiler>
|
||||||
|
<Add option="-g" />
|
||||||
|
</Compiler>
|
||||||
|
</Target>
|
||||||
|
<Target title="Release">
|
||||||
|
<Option output="bin/Release/p1" prefix_auto="1" extension_auto="1" />
|
||||||
|
<Option object_output="obj/Release/" />
|
||||||
|
<Option type="1" />
|
||||||
|
<Option compiler="gcc" />
|
||||||
|
<Compiler>
|
||||||
|
<Add option="-O2" />
|
||||||
|
</Compiler>
|
||||||
|
<Linker>
|
||||||
|
<Add option="-s" />
|
||||||
|
</Linker>
|
||||||
|
</Target>
|
||||||
|
</Build>
|
||||||
|
<Compiler>
|
||||||
|
<Add option="-Wall" />
|
||||||
|
<Add option="-fexceptions" />
|
||||||
|
</Compiler>
|
||||||
|
<Unit filename="main.cpp" />
|
||||||
|
<Extensions>
|
||||||
|
<code_completion />
|
||||||
|
<envvars />
|
||||||
|
<debugger />
|
||||||
|
</Extensions>
|
||||||
|
</Project>
|
||||||
|
</CodeBlocks_project_file>
|
Loading…
Add table
Reference in a new issue