Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • lifap6/tp-listes-etu
  • p2205540/tp-listes-etu
  • p1716451/tp-listes-etu
  • p2018814/apctp
  • p2308474/tp-listes-etu
  • p1801979/tp-listes-etu
  • p2310736/tp-listes-etu
  • p2006656/tp-listes-etu
  • p1608911/tp-listes-etu
  • lifapc3/tp1
  • p2210147/tp-listes-etu
  • p2105803/lifapc-tp-listes-etu
  • p2002046/tp-listes-etu
  • p1520557/tp-listes-etu
  • p2200355/tp-listes-etu
  • p2210217/tp-listes-etu
  • p2407232/tp-listes-etu
  • p1805309/tp-listes-etu
  • JEAN-CLAUDE.IEHL/tp-listes-etu
  • nicolas.louvet/tp-listes-etu
  • p2210857/tp-listes-etu
  • p1803588/tp-listes-etu
  • p2310921/tp-listes-etu
  • p2409710/tp-listes-etu
  • p1706748/tp-listes-etu
  • p1804713/tp-listes-etu
  • p1805738/tp-listes-etu
  • p1805563/tp-listes-etu
  • p1914050/tp-listes-etu
  • p1713323/tp-listes-etu
  • p1706619/tp-listes-etu
  • p2211882/tp-listes-etu
  • p2021420/tp-listes-etu-COM
  • p1923495/tp-listes-etu
  • p2102825/tp-listes-etu
  • p2100037/TP1
  • p2105932/tp-listes-etu
  • p2003011/tp-listes-etu
  • p2102216/tp-listes-etu
  • p2103016/tp-listes-etu
  • joachim.cendrier1/tp-listes-etu
41 results
Show changes
Commits on Source (10)
list-build:
stage: build
image: gcc
script:
- cd Src
- make test_liste
artifacts:
paths:
- Src/test_liste
list-test:
stage: test
script:
- Src/test_liste
dependencies:
- list-build
# Version minimale de CMake requise
cmake_minimum_required(VERSION 3.12)
project(liste)
# Sources
set(test_sources
src/cellule.hpp
src/cellule.cpp
src/liste.hpp
src/liste.cpp
)
# Applications
add_executable(test_liste ${test_sources} src/test_liste.cpp)
if(UNIX)
set(serpent_sources
src/coordonnees.hpp
src/coordonnees.cpp
src/niveau.hpp
src/niveau.cpp
src/serpent.hpp
src/serpent.cpp
)
find_package(Curses REQUIRED)
add_executable(jeu_serpent EXCLUDE_FROM_ALL ${test_sources} ${serpent_sources} src/jeu_serpent.cpp)
target_include_directories(jeu_serpent PUBLIC ${CURSES_INCLUDE_DIR})
target_link_libraries(jeu_serpent ${CURSES_LIBRARIES})
endif(UNIX)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="svg2"
width="913"
height="226"
viewBox="0 0 913 226"
sodipodi:docname="gitlab_buttons.svg"
inkscape:version="0.92.2 5c3e80d, 2017-08-06">
<metadata
id="metadata8">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs6">
<marker
inkscape:isstock="true"
style="overflow:visible;"
id="marker1145"
refX="0.0"
refY="0.0"
orient="auto"
inkscape:stockid="Arrow2Mend">
<path
transform="scale(0.6) rotate(180) translate(0,0)"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#cc0000;stroke-opacity:1;fill:#cc0000;fill-opacity:1"
id="path1143" />
</marker>
<marker
inkscape:stockid="Arrow2Mend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Mend"
style="overflow:visible;"
inkscape:isstock="true"
inkscape:collect="always">
<path
id="path850"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#cc0000;stroke-opacity:1;fill:#cc0000;fill-opacity:1"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(0.6) rotate(180) translate(0,0)" />
</marker>
<marker
inkscape:stockid="Arrow2Lend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Lend"
style="overflow:visible;"
inkscape:isstock="true">
<path
id="path844"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#cc0000;stroke-opacity:1;fill:#cc0000;fill-opacity:1"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(1.1) rotate(180) translate(1,0)" />
</marker>
</defs>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="640"
inkscape:window-height="480"
id="namedview4"
showgrid="false"
inkscape:zoom="1.2179628"
inkscape:cx="447.37924"
inkscape:cy="206.9894"
inkscape:current-layer="svg2" />
<image
width="913"
height="226"
preserveAspectRatio="none"
xlink:href="file:///tmp/gitlab_buttons.png"
id="image10"
x="0"
y="0"
sodipodi:absref="/tmp/gitlab_buttons.png" />
<path
style="opacity:1;fill:none;fill-opacity:1;stroke:#cc0000;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow2Mend)"
d="M 148.60881,66.717626 165.85072,168.52698"
id="path817"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:200px;font-family:'Linux Libertine';-inkscape-font-specification:'Linux Libertine';letter-spacing:0px;word-spacing:0px;fill:#cc0000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
x="68.146584"
y="50.296764"
id="text821"><tspan
sodipodi:role="line"
id="tspan819"
x="68.146584"
y="50.296764">Dupliquer le dépôt</tspan></text>
<path
inkscape:connector-curvature="0"
id="path1137"
d="M 669.15018,60.149281 583.7617,172.63219"
style="opacity:1;fill:none;fill-opacity:1;stroke:#cc0000;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#marker1145)"
sodipodi:nodetypes="cc" />
<text
id="text1141"
y="50.296764"
x="591.97211"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.5px;line-height:200px;font-family:'Linux Libertine';-inkscape-font-specification:'Linux Libertine';letter-spacing:0px;word-spacing:0px;fill:#cc0000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="50.296764"
x="591.97211"
id="tspan1139"
sodipodi:role="line">Adresse du dépôt</tspan></text>
</svg>
#ifndef LIFAP6_LISTE_CELLULE_HPP
#define LIFAP6_LISTE_CELLULE_HPP
class Cellule {
/* votre code ici */
} ;
#endif
#include "liste.hpp"
#include <iostream>
#include <cassert>
Liste::Liste() {
/* votre code ici */
}
Liste::Liste(const Liste& autre) {
/* votre code ici */
}
Liste& Liste::operator=(const Liste& autre) {
/* votre code ici */
return *this ;
}
Liste::~Liste() {
/* votre code ici */
}
void Liste::ajouter_en_tete(int valeur) {
/* votre code ici */
}
void Liste::ajouter_en_queue(int valeur) {
/* votre code ici */
}
void Liste::supprimer_en_tete() {
/* votre code ici */
}
Cellule* Liste::tete() {
/* votre code ici */
return nullptr ;
}
const Cellule* Liste::tete() const {
/* votre code ici */
return nullptr ;
}
Cellule* Liste::queue() {
/* votre code ici */
return nullptr ;
}
const Cellule* Liste::queue() const {
/* votre code ici */
return nullptr ;
}
int Liste::taille() const {
/* votre code ici */
return 0 ;
}
Cellule* Liste::recherche(int valeur) {
/* votre code ici */
return nullptr ;
}
const Cellule* Liste::recherche(int valeur) const {
/* votre code ici */
return nullptr ;
}
void Liste::afficher() const {
/* votre code ici */
}
#ifndef LIFAP6_LISTE_LISTE_HPP
#define LIFAP6_LISTE_LISTE_HPP
#include "cellule.hpp"
class Liste {
public :
/* construction d'une liste vide */
Liste() ;
/* construction par copie */
Liste(const Liste& autre) ;
/* affectation */
Liste& operator=(const Liste& autre) ;
/* destruction */
~Liste() ;
/* ajout en tete */
void ajouter_en_tete(int valeur) ;
/* ajout en queue */
void ajouter_en_queue(int valeur) ;
/* suppression en tete */
void supprimer_en_tete() ;
/* consultation de la tete */
const Cellule* tete() const ;
Cellule* tete() ;
/* consultation de la queue */
const Cellule* queue() const ;
Cellule* queue() ;
/* taille de la liste */
int taille() const ;
/* recherche dans la liste */
const Cellule* recherche(int valeur) const ;
Cellule* recherche(int valeur) ;
/* affichage */
void afficher() const ;
private :
/* votre code ici */
} ;
#endif
#include "liste.hpp"
#include <iostream>
#include <cassert>
int main() {
/* adaptez ce fichier selon votre structure */
Liste l1 ;
l1.ajouter_en_tete(10) ;
l1.ajouter_en_tete(11) ;
std::cout << "attendu : [ 11 10 ]" << std::endl ;
l1.afficher() ; // [ 11 10 ]
assert(l1.tete()->valeur == 11) ;
assert(l1.queue()->valeur == 10) ;
assert(l1.recherche(11)) ;
assert(l1.recherche(10)) ;
assert(!l1.recherche(12)) ;
assert(l1.taille() == 2) ;
Liste l2(l1) ;
l2.ajouter_en_tete(20) ;
std::cout << "attendu : [ 20 11 10 ]" << std::endl ;
l2.afficher() ; // [ 20 11 10 ]
assert(l2.tete()->valeur == 20) ;
assert(l2.queue()->valeur == 10) ;
assert(l2.recherche(20)) ;
assert(l2.recherche(11)) ;
assert(l2.recherche(10)) ;
assert(!l2.recherche(21)) ;
Liste l3 ;
l3.ajouter_en_tete(30) ;
l3 = l1 ;
std::cout << "attendu : [ 11 10 ]" << std::endl ;
l3.afficher() ; // [ 11 10 ]
assert(l3.tete()->valeur == 11) ;
assert(l3.queue()->valeur == 10) ;
assert(l3.recherche(11)) ;
assert(l3.recherche(10)) ;
assert(!l3.recherche(30)) ;
l1.supprimer_en_tete() ;
l1.afficher() ; // [ 10 ]
assert(l1.tete()->valeur == 10) ;
assert(l1.queue()->valeur == 10) ;
assert(l1.recherche(10)) ;
assert(!l1.recherche(11)) ;
l1.ajouter_en_tete(12) ;
std::cout << "attendu : [ 12 10 ]" << std::endl ;
l1.afficher() ; // [ 12 10 ]
assert(l1.tete()->valeur == 12) ;
assert(l1.recherche(10)) ;
std::cout << "attendu : [ 20 11 10 ]" << std::endl ;
l2.afficher() ; // [ 20 11 10 ]
assert(l2.tete()->valeur == 20) ;
assert(l2.recherche(11)) ;
assert(l2.recherche(10)) ;
std::cout << "attendu : [ 11 10 ]" << std::endl ;
l3.afficher() ; // [ 11 10 ]
assert(l3.tete()->valeur == 11) ;
assert(l3.recherche(10)) ;
l3.ajouter_en_queue(31) ;
std::cout << "attendu : [ 11 10 31 ]" << std::endl ;
l3.afficher() ; // [ 11 10 31 ]
assert(l3.tete()->valeur == 11) ;
assert(l3.queue()->valeur == 31) ;
assert(l3.recherche(11)) ;
assert(l3.recherche(10)) ;
assert(l3.recherche(31)) ;
return 0 ;
}
File moved
This diff is collapsed.
File moved
File moved
File moved
This diff is collapsed.
\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{libertine}
\usepackage{tikz}
\usetikzlibrary{positioning, shadows, calc, shapes.multipart, chains, arrows}
\tikzset{ list/.style= {
rectangle split,
rectangle split parts = 2,
draw,
rounded corners,
rectangle split horizontal,
append after command={
let \p1 = (\tikzlastnode.east),
\p2 = (\tikzlastnode.center),
\n1 = {0.5 * (\x1 + \x2)} in
(\n1,\y2) node[inner sep = 0pt, outer sep = 0pt] (\tikzlastnode +next) {}
}
}}
\tikzset{ ptr/.style= {
draw,
*-latex,
rounded corners,
shorten <= -2.5pt
}}
\begin{document}
\begin{tikzpicture}[start chain]
\draw node[list, on chain] (c1) {13} ;
\draw node[list, on chain] (c2) {12} ;
\draw node[list, on chain] (c3) {11} ;
\draw node[list, on chain] (c4) {10} ;
\draw node[on chain] (null) {$\times$} ;
\draw (c2) node[above = 1cm] (current) {courante} ;
\draw[ptr] (c1+next) -- (c2) ;
\draw[ptr] (c2+next) -- (c3) ;
\draw[ptr] (c3+next) -- (c4) ;
\draw[ptr] (c4+next) -- (null) ;
\draw[-latex, shorten >= 2pt] (current) -- (c2) ;
\end{tikzpicture}
\end{document}
This diff is collapsed.
......@@ -8,7 +8,7 @@ SOURCES += liste.cpp
OBJECTS = $(SOURCES:.cpp=.o)
CXXFLAGS += -g -Wall -std=c++11 -pedantic
CXXFLAGS += -g -Wall -pedantic
LDFLAGS +=
$(OBJECTS) : %.o : %.cpp
......@@ -47,7 +47,9 @@ jeu_serpent : $(SERPENT_OBJECTS) $(OBJECTS) $(HEADERS)
$(SERPENT_OBJECTS): %.o : %.cpp
$(CXX) -MMD $(CXXFLAGS) -c $< -o $@
all : jeu_serpent
# decommenter ci-dessous pour faire le serpent
# attention ncurses pas disponible sous windows
# all : jeu_serpent
TARGETS += jeu_serpent
CLEAN_OBJECTS += $(SERPENT_OBJECTS)
......
File moved
#ifndef LIFAPC_LISTE_CELLULE_HPP
#define LIFAPC_LISTE_CELLULE_HPP
class Cellule {
public:
/* votre code ici */
/* valeur : entier stocke dans la cellule
* suivante : adresse ce la cellule suivante
*/
} ;
#endif
File moved
#ifndef LIFAP6_LISTES_COORDONNEES_HPP
#define LIFAP6_LISTES_COORDONNEES_HPP
#ifndef LIFAPC_LISTES_COORDONNEES_HPP
#define LIFAPC_LISTES_COORDONNEES_HPP
/* encodage ligne / colonne short int dans un int */
int encode(short int l, short int c) ;
......