@ -0,0 +1,87 @@
|
||||
#include "SAE.h"
|
||||
|
||||
int Ouverture(int tNoCarte[],int tnom[], int tprenom[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitéesJour[])
|
||||
{
|
||||
int NoCarte, nom, prenom, age, pointsCarte, CarteActive, nbActivitéesJour;
|
||||
int tmax = 500, i = 0;
|
||||
int tNoCarte[500], tage[500], tPointsCarte[500], tNbActivitéesJour[500];
|
||||
char tnom[500], tprenom[500];
|
||||
char tCarteActive[500];
|
||||
FILE *flot;
|
||||
flot = fopen("membres.don", "r");
|
||||
if(flot == NULL)
|
||||
{
|
||||
printf("Pb d'ouverture du fichier membres.don\n");
|
||||
return -1;
|
||||
}
|
||||
fscanf(flot, "%d%d%d%d%d%d%d", &NoCarte, &nom, &prenom, &age, &pointsCarte, &CarteActive, &nbActivitéesJour);
|
||||
while(!feof(flot))
|
||||
{
|
||||
if(i == tmax)
|
||||
{
|
||||
printf("Tableau plein\n");
|
||||
fclose(flot);
|
||||
return -1;
|
||||
}
|
||||
tNoCarte[i] = NoCarte;
|
||||
tnom[i] = nom;
|
||||
tprenom[i] = prenom;
|
||||
tage[i] = age;
|
||||
tPointsCarte[i] = pointsCarte;
|
||||
tCarteActive[i] = CarteActive;
|
||||
tNbActivitéesJour[i] = nbActivitéesJour;
|
||||
fscanf(flot, "%d%d%d%d%d%d%d", &NoCarte, &nom, &prenom, &age, &pointsCarte, &CarteActive, &nbActivitéesJour);
|
||||
i++;
|
||||
}
|
||||
fclose(flot);
|
||||
return i;
|
||||
}
|
||||
|
||||
void pointsBonus()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Sauvegarde(int tNoCarte[],int tnom[], int tprenom[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitéesJour[], int nbelem)
|
||||
{
|
||||
int i;
|
||||
FILE *flot;
|
||||
flot = fopen("membres.don", "w");
|
||||
if(flot == NULL)
|
||||
{
|
||||
printf("Pb d'ouverture du fichier membres.don\n");
|
||||
return -1;
|
||||
}
|
||||
for(i = 0; i < (nbelem-1); i++)
|
||||
{
|
||||
fprintf(flot, "%d\t%d\t%d\t%d\t%d\t%d\t%d\n", tNoCarte[i], tnom[i], tprenom[i], tage[i], tPointsCarte[i], tCarteActive[i], tNbActivitéesJour[i]);
|
||||
}
|
||||
fclose(flot);
|
||||
}
|
||||
|
||||
int rechercheEtCreation(int tNoCarte[], int nbClients)
|
||||
{
|
||||
int NoCarte, i;
|
||||
for( i=0; i < nbClients; i++)
|
||||
{
|
||||
if(i != tNoCarte[i])
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
int CreationAdherents(int tAdherents[], nbClients)
|
||||
{
|
||||
int NoCarte, nom, prenom, age, pointsCarte, CarteActive, nbActivitéesJour;
|
||||
printf("Donnez le nom, le prénom, l'âge du client :\n");
|
||||
scanf("%d%d%d", &nom, &prenom, &age);
|
||||
pas = rechercheEtCreation(tAdherents, nbClients);
|
||||
}
|
||||
|
||||
int FrequenceCentre()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int Ouverture();
|
||||
int pointsBonus();
|
||||
void sauvegarde();
|
||||
int CreationAdherent();
|
||||
int FrequenceCentre();
|
@ -0,0 +1 @@
|
||||
N° de carte Active ? nbPoints
|
@ -0,0 +1,3 @@
|
||||
Ncarte age pointsCarte carteActive
|
||||
1 19 22 1
|
||||
3 22 0 1
|
@ -0,0 +1 @@
|
||||
Subproject commit cea166d7ebbf85964e6afac272b78d52f0a3615b
|
@ -0,0 +1,7 @@
|
||||
#include "SAE.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
After Width: | Height: | Size: 676 B |
After Width: | Height: | Size: 147 B |
After Width: | Height: | Size: 132 B |
After Width: | Height: | Size: 746 B |
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,121 @@
|
||||
/*
|
||||
@licstart The following is the entire license notice for the JavaScript code in this file.
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 1997-2020 by Dimitri van Heesch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@licend The above is the entire license notice for the JavaScript code in this file
|
||||
*/
|
||||
function toggleVisibility(linkObj)
|
||||
{
|
||||
var base = $(linkObj).attr('id');
|
||||
var summary = $('#'+base+'-summary');
|
||||
var content = $('#'+base+'-content');
|
||||
var trigger = $('#'+base+'-trigger');
|
||||
var src=$(trigger).attr('src');
|
||||
if (content.is(':visible')===true) {
|
||||
content.hide();
|
||||
summary.show();
|
||||
$(linkObj).addClass('closed').removeClass('opened');
|
||||
$(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
|
||||
} else {
|
||||
content.show();
|
||||
summary.hide();
|
||||
$(linkObj).removeClass('closed').addClass('opened');
|
||||
$(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function updateStripes()
|
||||
{
|
||||
$('table.directory tr').
|
||||
removeClass('even').filter(':visible:even').addClass('even');
|
||||
}
|
||||
|
||||
function toggleLevel(level)
|
||||
{
|
||||
$('table.directory tr').each(function() {
|
||||
var l = this.id.split('_').length-1;
|
||||
var i = $('#img'+this.id.substring(3));
|
||||
var a = $('#arr'+this.id.substring(3));
|
||||
if (l<level+1) {
|
||||
i.removeClass('iconfopen iconfclosed').addClass('iconfopen');
|
||||
a.html('▼');
|
||||
$(this).show();
|
||||
} else if (l==level+1) {
|
||||
i.removeClass('iconfclosed iconfopen').addClass('iconfclosed');
|
||||
a.html('►');
|
||||
$(this).show();
|
||||
} else {
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
updateStripes();
|
||||
}
|
||||
|
||||
function toggleFolder(id)
|
||||
{
|
||||
// the clicked row
|
||||
var currentRow = $('#row_'+id);
|
||||
|
||||
// all rows after the clicked row
|
||||
var rows = currentRow.nextAll("tr");
|
||||
|
||||
var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub
|
||||
|
||||
// only match elements AFTER this one (can't hide elements before)
|
||||
var childRows = rows.filter(function() { return this.id.match(re); });
|
||||
|
||||
// first row is visible we are HIDING
|
||||
if (childRows.filter(':first').is(':visible')===true) {
|
||||
// replace down arrow by right arrow for current row
|
||||
var currentRowSpans = currentRow.find("span");
|
||||
currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
|
||||
currentRowSpans.filter(".arrow").html('►');
|
||||
rows.filter("[id^=row_"+id+"]").hide(); // hide all children
|
||||
} else { // we are SHOWING
|
||||
// replace right arrow by down arrow for current row
|
||||
var currentRowSpans = currentRow.find("span");
|
||||
currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen");
|
||||
currentRowSpans.filter(".arrow").html('▼');
|
||||
// replace down arrows by right arrows for child rows
|
||||
var childRowsSpans = childRows.find("span");
|
||||
childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
|
||||
childRowsSpans.filter(".arrow").html('►');
|
||||
childRows.show(); //show all children
|
||||
}
|
||||
updateStripes();
|
||||
}
|
||||
|
||||
|
||||
function toggleInherit(id)
|
||||
{
|
||||
var rows = $('tr.inherit.'+id);
|
||||
var img = $('tr.inherit_header.'+id+' img');
|
||||
var src = $(img).attr('src');
|
||||
if (rows.filter(':first').is(':visible')===true) {
|
||||
rows.css('display','none');
|
||||
$(img).attr('src',src.substring(0,src.length-8)+'closed.png');
|
||||
} else {
|
||||
rows.css('display','table-row'); // using show() causes jump in firefox
|
||||
$(img).attr('src',src.substring(0,src.length-10)+'open.png');
|
||||
}
|
||||
}
|
||||
/* @license-end */
|
@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>TP1: File List</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">TP1
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">File List</div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock">Here is a list of all documented files with brief descriptions:</div><div class="directory">
|
||||
<table class="directory">
|
||||
<tr id="row_0_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </span><a href="tp1_8h_source.html"><span class="icondoc"></span></a><b>tp1.h</b></td><td class="desc"></td></tr>
|
||||
</table>
|
||||
</div><!-- directory -->
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
After Width: | Height: | Size: 616 B |
After Width: | Height: | Size: 597 B |
@ -0,0 +1,134 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>TP1: Graph Legend</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">TP1
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Graph Legend</div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<p>This page explains how to interpret the graphs that are generated by doxygen.</p>
|
||||
<p>Consider the following example: </p><div class="fragment"><div class="line"><span class="comment">/*! Invisible class because of truncation */</span></div>
|
||||
<div class="line"><span class="keyword">class </span>Invisible { };</div>
|
||||
<div class="line"><span class="comment"></span> </div>
|
||||
<div class="line"><span class="comment">/*! Truncated class, inheritance relation is hidden */</span></div>
|
||||
<div class="line"><span class="keyword">class </span>Truncated : <span class="keyword">public</span> Invisible { };</div>
|
||||
<div class="line"> </div>
|
||||
<div class="line"><span class="comment">/* Class not documented with doxygen comments */</span></div>
|
||||
<div class="line"><span class="keyword">class </span>Undocumented { };</div>
|
||||
<div class="line"><span class="comment"></span> </div>
|
||||
<div class="line"><span class="comment">/*! Class that is inherited using public inheritance */</span></div>
|
||||
<div class="line"><span class="keyword">class </span>PublicBase : <span class="keyword">public</span> Truncated { };</div>
|
||||
<div class="line"><span class="comment"></span> </div>
|
||||
<div class="line"><span class="comment">/*! A template class */</span></div>
|
||||
<div class="line"><span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">class </span>Templ { };</div>
|
||||
<div class="line"><span class="comment"></span> </div>
|
||||
<div class="line"><span class="comment">/*! Class that is inherited using protected inheritance */</span></div>
|
||||
<div class="line"><span class="keyword">class </span>ProtectedBase { };</div>
|
||||
<div class="line"><span class="comment"></span> </div>
|
||||
<div class="line"><span class="comment">/*! Class that is inherited using private inheritance */</span></div>
|
||||
<div class="line"><span class="keyword">class </span>PrivateBase { };</div>
|
||||
<div class="line"><span class="comment"></span> </div>
|
||||
<div class="line"><span class="comment">/*! Class that is used by the Inherited class */</span></div>
|
||||
<div class="line"><span class="keyword">class </span>Used { };</div>
|
||||
<div class="line"><span class="comment"></span> </div>
|
||||
<div class="line"><span class="comment">/*! Super class that inherits a number of other classes */</span></div>
|
||||
<div class="line"><span class="keyword">class </span>Inherited : <span class="keyword">public</span> PublicBase,</div>
|
||||
<div class="line"> <span class="keyword">protected</span> ProtectedBase,</div>
|
||||
<div class="line"> <span class="keyword">private</span> PrivateBase,</div>
|
||||
<div class="line"> <span class="keyword">public</span> Undocumented,</div>
|
||||
<div class="line"> <span class="keyword">public</span> Templ<int></div>
|
||||
<div class="line">{</div>
|
||||
<div class="line"> <span class="keyword">private</span>:</div>
|
||||
<div class="line"> Used *m_usedClass;</div>
|
||||
<div class="line">};</div>
|
||||
</div><!-- fragment --><p> This will result in the following graph:</p>
|
||||
<center><img src="graph_legend.png" alt="" class="inline"/></center><p>The boxes in the above graph have the following meaning: </p>
|
||||
<ul>
|
||||
<li>
|
||||
A filled gray box represents the struct or class for which the graph is generated. </li>
|
||||
<li>
|
||||
A box with a black border denotes a documented struct or class. </li>
|
||||
<li>
|
||||
A box with a gray border denotes an undocumented struct or class. </li>
|
||||
<li>
|
||||
A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries. </li>
|
||||
</ul>
|
||||
<p>The arrows have the following meaning: </p>
|
||||
<ul>
|
||||
<li>
|
||||
A dark blue arrow is used to visualize a public inheritance relation between two classes. </li>
|
||||
<li>
|
||||
A dark green arrow is used for protected inheritance. </li>
|
||||
<li>
|
||||
A dark red arrow is used for private inheritance. </li>
|
||||
<li>
|
||||
A purple dashed arrow is used if a class is contained or used by another class. The arrow is labelled with the variable(s) through which the pointed class or struct is accessible. </li>
|
||||
<li>
|
||||
A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labelled with the template parameters of the instance. </li>
|
||||
</ul>
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1 @@
|
||||
f51bf6e9a10430aafef59831b08dcbfe
|
After Width: | Height: | Size: 20 KiB |
@ -0,0 +1,74 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>TP1: Main Page</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">TP1
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">TP1 Documentation</div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
</div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
@licstart The following is the entire license notice for the JavaScript code in this file.
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 1997-2020 by Dimitri van Heesch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@licend The above is the entire license notice for the JavaScript code in this file
|
||||
*/
|
||||
function initMenu(relPath,searchEnabled,serverSide,searchPage,search) {
|
||||
function makeTree(data,relPath) {
|
||||
var result='';
|
||||
if ('children' in data) {
|
||||
result+='<ul>';
|
||||
for (var i in data.children) {
|
||||
result+='<li><a href="'+relPath+data.children[i].url+'">'+
|
||||
data.children[i].text+'</a>'+
|
||||
makeTree(data.children[i],relPath)+'</li>';
|
||||
}
|
||||
result+='</ul>';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
$('#main-nav').append(makeTree(menudata,relPath));
|
||||
$('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu');
|
||||
if (searchEnabled) {
|
||||
if (serverSide) {
|
||||
$('#main-menu').append('<li style="float:right"><div id="MSearchBox" class="MSearchBoxInactive"><div class="left"><form id="FSearchBox" action="'+relPath+searchPage+'" method="get"><img id="MSearchSelect" src="'+relPath+'search/mag.svg" alt=""/><input type="text" id="MSearchField" name="query" value="'+search+'" size="20" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)"></form></div><div class="right"></div></div></li>');
|
||||
} else {
|
||||
$('#main-menu').append('<li style="float:right"><div id="MSearchBox" class="MSearchBoxInactive"><span class="left"><img id="MSearchSelect" src="'+relPath+'search/mag_sel.svg" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/><input type="text" id="MSearchField" value="'+search+'" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/></span><span class="right"><a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="'+relPath+'search/close.svg" alt=""/></a></span></div></li>');
|
||||
}
|
||||
}
|
||||
$('#main-menu').smartmenus();
|
||||
}
|
||||
/* @license-end */
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
@licstart The following is the entire license notice for the JavaScript code in this file.
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 1997-2020 by Dimitri van Heesch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@licend The above is the entire license notice for the JavaScript code in this file
|
||||
*/
|
||||
var menudata={children:[
|
||||
{text:"Main Page",url:"index.html"},
|
||||
{text:"Files",url:"files.html",children:[
|
||||
{text:"File List",url:"files.html"}]}]}
|
After Width: | Height: | Size: 153 B |
After Width: | Height: | Size: 95 B |
After Width: | Height: | Size: 98 B |
After Width: | Height: | Size: 123 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.3 KiB |
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head><title></title>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="search.css"/>
|
||||
<script type="text/javascript" src="search.js"></script>
|
||||
</head>
|
||||
<body class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,257 @@
|
||||
/*---------------- Search Box */
|
||||
|
||||
#MSearchBox {
|
||||
white-space : nowrap;
|
||||
background: white;
|
||||
border-radius: 0.65em;
|
||||
box-shadow: inset 0.5px 0.5px 3px 0px #555;
|
||||
z-index: 102;
|
||||
}
|
||||
|
||||
#MSearchBox .left {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
height: 1.4em;
|
||||
}
|
||||
|
||||
#MSearchSelect {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
height: 1.4em;
|
||||
padding: 0 0 0 0.3em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#MSearchField {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 7.5em;
|
||||
height: 1.1em;
|
||||
margin: 0 0.15em;
|
||||
padding: 0;
|
||||
line-height: 1em;
|
||||
border:none;
|
||||
color: #909090;
|
||||
outline: none;
|
||||
font-family: Arial, Verdana, sans-serif;
|
||||
-webkit-border-radius: 0px;
|
||||
border-radius: 0px;
|
||||
background: none;
|
||||
}
|
||||
|
||||
|
||||
#MSearchBox .right {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 1.4em;
|
||||
height: 1.4em;
|
||||
}
|
||||
|
||||
#MSearchClose {
|
||||
display: none;
|
||||
font-size: inherit;
|
||||
background : none;
|
||||
border: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
outline: none;
|
||||
|
||||
}
|
||||
|
||||
#MSearchCloseImg {
|
||||
height: 1.4em;
|
||||
padding: 0.3em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.MSearchBoxActive #MSearchField {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#main-menu > li:last-child {
|
||||
/* This <li> object is the parent of the search bar */
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 36px;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
/*---------------- Search filter selection */
|
||||
|
||||
#MSearchSelectWindow {
|
||||
display: none;
|
||||
position: absolute;
|
||||
left: 0; top: 0;
|
||||
border: 1px solid #90A5CE;
|
||||
background-color: #F9FAFC;
|
||||
z-index: 10001;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-top-left-radius: 4px;
|
||||
-webkit-border-top-right-radius: 4px;
|
||||
-webkit-border-bottom-left-radius: 4px;
|
||||
-webkit-border-bottom-right-radius: 4px;
|
||||
-webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.SelectItem {
|
||||
font: 8pt Arial, Verdana, sans-serif;
|
||||
padding-left: 2px;
|
||||
padding-right: 12px;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
span.SelectionMark {
|
||||
margin-right: 4px;
|
||||
font-family: monospace;
|
||||
outline-style: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.SelectItem {
|
||||
display: block;
|
||||
outline-style: none;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
padding-left: 6px;
|
||||
padding-right: 12px;
|
||||
}
|
||||
|
||||
a.SelectItem:focus,
|
||||
a.SelectItem:active {
|
||||
color: #000000;
|
||||
outline-style: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.SelectItem:hover {
|
||||
color: #FFFFFF;
|
||||
background-color: #3D578C;
|
||||
outline-style: none;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*---------------- Search results window */
|
||||
|
||||
iframe#MSearchResults {
|
||||
width: 60ex;
|
||||
height: 15em;
|
||||
}
|
||||
|
||||
#MSearchResultsWindow {
|
||||
display: none;
|
||||
position: absolute;
|
||||
left: 0; top: 0;
|
||||
border: 1px solid #000;
|
||||
background-color: #EEF1F7;
|
||||
z-index:10000;
|
||||
}
|
||||
|
||||
/* ----------------------------------- */
|
||||
|
||||
|
||||
#SRIndex {
|
||||
clear:both;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.SREntry {
|
||||
font-size: 10pt;
|
||||
padding-left: 1ex;
|
||||
}
|
||||
|
||||
.SRPage .SREntry {
|
||||
font-size: 8pt;
|
||||
padding: 1px 5px;
|
||||
}
|
||||
|
||||
body.SRPage {
|
||||
margin: 5px 2px;
|
||||
}
|
||||
|
||||
.SRChildren {
|
||||
padding-left: 3ex; padding-bottom: .5em
|
||||
}
|
||||
|
||||
.SRPage .SRChildren {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.SRSymbol {
|
||||
font-weight: bold;
|
||||
color: #425E97;
|
||||
font-family: Arial, Verdana, sans-serif;
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
a.SRScope {
|
||||
display: block;
|
||||
color: #425E97;
|
||||
font-family: Arial, Verdana, sans-serif;
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
a.SRSymbol:focus, a.SRSymbol:active,
|
||||
a.SRScope:focus, a.SRScope:active {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
span.SRScope {
|
||||
padding-left: 4px;
|
||||
font-family: Arial, Verdana, sans-serif;
|
||||
}
|
||||
|
||||
.SRPage .SRStatus {
|
||||
padding: 2px 5px;
|
||||
font-size: 8pt;
|
||||
font-style: italic;
|
||||
font-family: Arial, Verdana, sans-serif;
|
||||
}
|
||||
|
||||
.SRResult {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.searchresults {
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
/*---------------- External search page results */
|
||||
|
||||
.searchresult {
|
||||
background-color: #F0F3F8;
|
||||
}
|
||||
|
||||
.pages b {
|
||||
color: white;
|
||||
padding: 5px 5px 3px 5px;
|
||||
background-image: url("../tab_a.png");
|
||||
background-repeat: repeat-x;
|
||||
text-shadow: 0 1px 1px #000000;
|
||||
}
|
||||
|
||||
.pages {
|
||||
line-height: 17px;
|
||||
margin-left: 4px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.hl {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#searchresults {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.searchpages {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
@ -0,0 +1,816 @@
|
||||
/*
|
||||
@licstart The following is the entire license notice for the JavaScript code in this file.
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 1997-2020 by Dimitri van Heesch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@licend The above is the entire license notice for the JavaScript code in this file
|
||||
*/
|
||||
function convertToId(search)
|
||||
{
|
||||
var result = '';
|
||||
for (i=0;i<search.length;i++)
|
||||
{
|
||||
var c = search.charAt(i);
|
||||
var cn = c.charCodeAt(0);
|
||||
if (c.match(/[a-z0-9\u0080-\uFFFF]/))
|
||||
{
|
||||
result+=c;
|
||||
}
|
||||
else if (cn<16)
|
||||
{
|
||||
result+="_0"+cn.toString(16);
|
||||
}
|
||||
else
|
||||
{
|
||||
result+="_"+cn.toString(16);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function getXPos(item)
|
||||
{
|
||||
var x = 0;
|
||||
if (item.offsetWidth)
|
||||
{
|
||||
while (item && item!=document.body)
|
||||
{
|
||||
x += item.offsetLeft;
|
||||
item = item.offsetParent;
|
||||
}
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
function getYPos(item)
|
||||
{
|
||||
var y = 0;
|
||||
if (item.offsetWidth)
|
||||
{
|
||||
while (item && item!=document.body)
|
||||
{
|
||||
y += item.offsetTop;
|
||||
item = item.offsetParent;
|
||||
}
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
/* A class handling everything associated with the search panel.
|
||||
|
||||
Parameters:
|
||||
name - The name of the global variable that will be
|
||||
storing this instance. Is needed to be able to set timeouts.
|
||||
resultPath - path to use for external files
|
||||
*/
|
||||
function SearchBox(name, resultsPath, inFrame, label, extension)
|
||||
{
|
||||
if (!name || !resultsPath) { alert("Missing parameters to SearchBox."); }
|
||||
if (!extension || extension == "") { extension = ".html"; }
|
||||
|
||||
// ---------- Instance variables
|
||||
this.name = name;
|
||||
this.resultsPath = resultsPath;
|
||||
this.keyTimeout = 0;
|
||||
this.keyTimeoutLength = 500;
|
||||
this.closeSelectionTimeout = 300;
|
||||
this.lastSearchValue = "";
|
||||
this.lastResultsPage = "";
|
||||
this.hideTimeout = 0;
|
||||
this.searchIndex = 0;
|
||||
this.searchActive = false;
|
||||
this.insideFrame = inFrame;
|
||||
this.searchLabel = label;
|
||||
this.extension = extension;
|
||||
|
||||
// ----------- DOM Elements
|
||||
|
||||
this.DOMSearchField = function()
|
||||
{ return document.getElementById("MSearchField"); }
|
||||
|
||||
this.DOMSearchSelect = function()
|
||||
{ return document.getElementById("MSearchSelect"); }
|
||||
|
||||
this.DOMSearchSelectWindow = function()
|
||||
{ return document.getElementById("MSearchSelectWindow"); }
|
||||
|
||||
this.DOMPopupSearchResults = function()
|
||||
{ return document.getElementById("MSearchResults"); }
|
||||
|
||||
this.DOMPopupSearchResultsWindow = function()
|
||||
{ return document.getElementById("MSearchResultsWindow"); }
|
||||
|
||||
this.DOMSearchClose = function()
|
||||
{ return document.getElementById("MSearchClose"); }
|
||||
|
||||
this.DOMSearchBox = function()
|
||||
{ return document.getElementById("MSearchBox"); }
|
||||
|
||||
// ------------ Event Handlers
|
||||
|
||||
// Called when focus is added or removed from the search field.
|
||||
this.OnSearchFieldFocus = function(isActive)
|
||||
{
|
||||
this.Activate(isActive);
|
||||
}
|
||||
|
||||
this.OnSearchSelectShow = function()
|
||||
{
|
||||
var searchSelectWindow = this.DOMSearchSelectWindow();
|
||||
var searchField = this.DOMSearchSelect();
|
||||
|
||||
if (this.insideFrame)
|
||||
{
|
||||
var left = getXPos(searchField);
|
||||
var top = getYPos(searchField);
|
||||
left += searchField.offsetWidth + 6;
|
||||
top += searchField.offsetHeight;
|
||||
|
||||
// show search selection popup
|
||||
searchSelectWindow.style.display='block';
|
||||
left -= searchSelectWindow.offsetWidth;
|
||||
searchSelectWindow.style.left = left + 'px';
|
||||
searchSelectWindow.style.top = top + 'px';
|
||||
}
|
||||
else
|
||||
{
|
||||
var left = getXPos(searchField);
|
||||
var top = getYPos(searchField);
|
||||
top += searchField.offsetHeight;
|
||||
|
||||
// show search selection popup
|
||||
searchSelectWindow.style.display='block';
|
||||
searchSelectWindow.style.left = left + 'px';
|
||||
searchSelectWindow.style.top = top + 'px';
|
||||
}
|
||||
|
||||
// stop selection hide timer
|
||||
if (this.hideTimeout)
|
||||
{
|
||||
clearTimeout(this.hideTimeout);
|
||||
this.hideTimeout=0;
|
||||
}
|
||||
return false; // to avoid "image drag" default event
|
||||
}
|
||||
|
||||
this.OnSearchSelectHide = function()
|
||||
{
|
||||
this.hideTimeout = setTimeout(this.name +".CloseSelectionWindow()",
|
||||
this.closeSelectionTimeout);
|
||||
}
|
||||
|
||||
// Called when the content of the search field is changed.
|
||||
this.OnSearchFieldChange = function(evt)
|
||||
{
|
||||
if (this.keyTimeout) // kill running timer
|
||||
{
|
||||
clearTimeout(this.keyTimeout);
|
||||
this.keyTimeout = 0;
|
||||
}
|
||||
|
||||
var e = (evt) ? evt : window.event; // for IE
|
||||
if (e.keyCode==40 || e.keyCode==13)
|
||||
{
|
||||
if (e.shiftKey==1)
|
||||
{
|
||||
this.OnSearchSelectShow();
|
||||
var win=this.DOMSearchSelectWindow();
|
||||
for (i=0;i<win.childNodes.length;i++)
|
||||
{
|
||||
var child = win.childNodes[i]; // get span within a
|
||||
if (child.className=='SelectItem')
|
||||
{
|
||||
child.focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
window.frames.MSearchResults.postMessage("take_focus", "*");
|
||||
}
|
||||
}
|
||||
else if (e.keyCode==27) // Escape out of the search field
|
||||
{
|
||||
this.DOMSearchField().blur();
|
||||
this.DOMPopupSearchResultsWindow().style.display = 'none';
|
||||
this.DOMSearchClose().style.display = 'none';
|
||||
this.lastSearchValue = '';
|
||||
this.Activate(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// strip whitespaces
|
||||
var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
|
||||
|
||||
if (searchValue != this.lastSearchValue) // search value has changed
|
||||
{
|
||||
if (searchValue != "") // non-empty search
|
||||
{
|
||||
// set timer for search update
|
||||
this.keyTimeout = setTimeout(this.name + '.Search()',
|
||||
this.keyTimeoutLength);
|
||||
}
|
||||
else // empty search field
|
||||
{
|
||||
this.DOMPopupSearchResultsWindow().style.display = 'none';
|
||||
this.DOMSearchClose().style.display = 'none';
|
||||
this.lastSearchValue = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.SelectItemCount = function(id)
|
||||
{
|
||||
var count=0;
|
||||
var win=this.DOMSearchSelectWindow();
|
||||
for (i=0;i<win.childNodes.length;i++)
|
||||
{
|
||||
var child = win.childNodes[i]; // get span within a
|
||||
if (child.className=='SelectItem')
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
this.SelectItemSet = function(id)
|
||||
{
|
||||
var i,j=0;
|
||||
var win=this.DOMSearchSelectWindow();
|
||||
for (i=0;i<win.childNodes.length;i++)
|
||||
{
|
||||
var child = win.childNodes[i]; // get span within a
|
||||
if (child.className=='SelectItem')
|
||||
{
|
||||
var node = child.firstChild;
|
||||
if (j==id)
|
||||
{
|
||||
node.innerHTML='•';
|
||||
}
|
||||
else
|
||||
{
|
||||
node.innerHTML=' ';
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called when an search filter selection is made.
|
||||
// set item with index id as the active item
|
||||
this.OnSelectItem = function(id)
|
||||
{
|
||||
this.searchIndex = id;
|
||||
this.SelectItemSet(id);
|
||||
var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
|
||||
if (searchValue!="" && this.searchActive) // something was found -> do a search
|
||||
{
|
||||
this.Search();
|
||||
}
|
||||
}
|
||||
|
||||
this.OnSearchSelectKey = function(evt)
|
||||
{
|
||||
var e = (evt) ? evt : window.event; // for IE
|
||||
if (e.keyCode==40 && this.searchIndex<this.SelectItemCount()) // Down
|
||||
{
|
||||
this.searchIndex++;
|
||||
this.OnSelectItem(this.searchIndex);
|
||||
}
|
||||
else if (e.keyCode==38 && this.searchIndex>0) // Up
|
||||
{
|
||||
this.searchIndex--;
|
||||
this.OnSelectItem(this.searchIndex);
|
||||
}
|
||||
else if (e.keyCode==13 || e.keyCode==27)
|
||||
{
|
||||
this.OnSelectItem(this.searchIndex);
|
||||
this.CloseSelectionWindow();
|
||||
this.DOMSearchField().focus();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// --------- Actions
|
||||
|
||||
// Closes the results window.
|
||||
this.CloseResultsWindow = function()
|
||||
{
|
||||
this.DOMPopupSearchResultsWindow().style.display = 'none';
|
||||
this.DOMSearchClose().style.display = 'none';
|
||||
this.Activate(false);
|
||||
}
|
||||
|
||||
this.CloseSelectionWindow = function()
|
||||
{
|
||||
this.DOMSearchSelectWindow().style.display = 'none';
|
||||
}
|
||||
|
||||
// Performs a search.
|
||||
this.Search = function()
|
||||
{
|
||||
this.keyTimeout = 0;
|
||||
|
||||
// strip leading whitespace
|
||||
var searchValue = this.DOMSearchField().value.replace(/^ +/, "");
|
||||
|
||||
var code = searchValue.toLowerCase().charCodeAt(0);
|
||||
var idxChar = searchValue.substr(0, 1).toLowerCase();
|
||||
if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1) // surrogate pair
|
||||
{
|
||||
idxChar = searchValue.substr(0, 2);
|
||||
}
|
||||
|
||||
var resultsPage;
|
||||
var resultsPageWithSearch;
|
||||
var hasResultsPage;
|
||||
|
||||
var idx = indexSectionsWithContent[this.searchIndex].indexOf(idxChar);
|
||||
if (idx!=-1)
|
||||
{
|
||||
var hexCode=idx.toString(16);
|
||||
resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + this.extension;
|
||||
resultsPageWithSearch = resultsPage+'?'+escape(searchValue);
|
||||
hasResultsPage = true;
|
||||
}
|
||||
else // nothing available for this search term
|
||||
{
|
||||
resultsPage = this.resultsPath + '/nomatches' + this.extension;
|
||||
resultsPageWithSearch = resultsPage;
|
||||
hasResultsPage = false;
|
||||
}
|
||||
|
||||
window.frames.MSearchResults.location = resultsPageWithSearch;
|
||||
var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow();
|
||||
|
||||
if (domPopupSearchResultsWindow.style.display!='block')
|
||||
{
|
||||
var domSearchBox = this.DOMSearchBox();
|
||||
this.DOMSearchClose().style.display = 'inline-block';
|
||||
if (this.insideFrame)
|
||||
{
|
||||
var domPopupSearchResults = this.DOMPopupSearchResults();
|
||||
domPopupSearchResultsWindow.style.position = 'relative';
|
||||
domPopupSearchResultsWindow.style.display = 'block';
|
||||
var width = document.body.clientWidth - 8; // the -8 is for IE :-(
|
||||
domPopupSearchResultsWindow.style.width = width + 'px';
|
||||
domPopupSearchResults.style.width = width + 'px';
|
||||
}
|
||||
else
|
||||
{
|
||||
var domPopupSearchResults = this.DOMPopupSearchResults();
|
||||
var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth;
|
||||
var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1;
|
||||
domPopupSearchResultsWindow.style.display = 'block';
|
||||
left -= domPopupSearchResults.offsetWidth;
|
||||
domPopupSearchResultsWindow.style.top = top + 'px';
|
||||
domPopupSearchResultsWindow.style.left = left + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
this.lastSearchValue = searchValue;
|
||||
this.lastResultsPage = resultsPage;
|
||||
}
|
||||
|
||||
// -------- Activation Functions
|
||||
|
||||
// Activates or deactivates the search panel, resetting things to
|
||||
// their default values if necessary.
|
||||
this.Activate = function(isActive)
|
||||
{
|
||||
if (isActive || // open it
|
||||
this.DOMPopupSearchResultsWindow().style.display == 'block'
|
||||
)
|
||||
{
|
||||
this.DOMSearchBox().className = 'MSearchBoxActive';
|
||||
|
||||
var searchField = this.DOMSearchField();
|
||||
|
||||
if (searchField.value == this.searchLabel) // clear "Search" term upon entry
|
||||
{
|
||||
searchField.value = '';
|
||||
this.searchActive = true;
|
||||
}
|
||||
}
|
||||
else if (!isActive) // directly remove the panel
|
||||
{
|
||||
this.DOMSearchBox().className = 'MSearchBoxInactive';
|
||||
this.DOMSearchField().value = this.searchLabel;
|
||||
this.searchActive = false;
|
||||
this.lastSearchValue = ''
|
||||
this.lastResultsPage = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// The class that handles everything on the search results page.
|
||||
function SearchResults(name)
|
||||
{
|
||||
// The number of matches from the last run of <Search()>.
|
||||
this.lastMatchCount = 0;
|
||||
this.lastKey = 0;
|
||||
this.repeatOn = false;
|
||||
|
||||
// Toggles the visibility of the passed element ID.
|
||||
this.FindChildElement = function(id)
|
||||
{
|
||||
var parentElement = document.getElementById(id);
|
||||
var element = parentElement.firstChild;
|
||||
|
||||
while (element && element!=parentElement)
|
||||
{
|
||||
if (element.nodeName.toLowerCase() == 'div' && element.className == 'SRChildren')
|
||||
{
|
||||
return element;
|
||||
}
|
||||
|
||||
if (element.nodeName.toLowerCase() == 'div' && element.hasChildNodes())
|
||||
{
|
||||
element = element.firstChild;
|
||||
}
|
||||
else if (element.nextSibling)
|
||||
{
|
||||
element = element.nextSibling;
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
element = element.parentNode;
|
||||
}
|
||||
while (element && element!=parentElement && !element.nextSibling);
|
||||
|
||||
if (element && element!=parentElement)
|
||||
{
|
||||
element = element.nextSibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.Toggle = function(id)
|
||||
{
|
||||
var element = this.FindChildElement(id);
|
||||
if (element)
|
||||
{
|
||||
if (element.style.display == 'block')
|
||||
{
|
||||
element.style.display = 'none';
|
||||
}
|
||||
else
|
||||
{
|
||||
element.style.display = 'block';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Searches for the passed string. If there is no parameter,
|
||||
// it takes it from the URL query.
|
||||
//
|
||||
// Always returns true, since other documents may try to call it
|
||||
// and that may or may not be possible.
|
||||
this.Search = function(search)
|
||||
{
|
||||
if (!search) // get search word from URL
|
||||
{
|
||||
search = window.location.search;
|
||||
search = search.substring(1); // Remove the leading '?'
|
||||
search = unescape(search);
|
||||
}
|
||||
|
||||
search = search.replace(/^ +/, ""); // strip leading spaces
|
||||
search = search.replace(/ +$/, ""); // strip trailing spaces
|
||||
search = search.toLowerCase();
|
||||
search = convertToId(search);
|
||||
|
||||
var resultRows = document.getElementsByTagName("div");
|
||||
var matches = 0;
|
||||
|
||||
var i = 0;
|
||||
while (i < resultRows.length)
|
||||
{
|
||||
var row = resultRows.item(i);
|
||||
if (row.className == "SRResult")
|
||||
{
|
||||
var rowMatchName = row.id.toLowerCase();
|
||||
rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_'
|
||||
|
||||
if (search.length<=rowMatchName.length &&
|
||||
rowMatchName.substr(0, search.length)==search)
|
||||
{
|
||||
row.style.display = 'block';
|
||||
matches++;
|
||||
}
|
||||
else
|
||||
{
|
||||
row.style.display = 'none';
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
document.getElementById("Searching").style.display='none';
|
||||
if (matches == 0) // no results
|
||||
{
|
||||
document.getElementById("NoMatches").style.display='block';
|
||||
}
|
||||
else // at least one result
|
||||
{
|
||||
document.getElementById("NoMatches").style.display='none';
|
||||
}
|
||||
this.lastMatchCount = matches;
|
||||
return true;
|
||||
}
|
||||
|
||||
// return the first item with index index or higher that is visible
|
||||
this.NavNext = function(index)
|
||||
{
|
||||
var focusItem;
|
||||
while (1)
|
||||
{
|
||||
var focusName = 'Item'+index;
|
||||
focusItem = document.getElementById(focusName);
|
||||
if (focusItem && focusItem.parentNode.parentNode.style.display=='block')
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (!focusItem) // last element
|
||||
{
|
||||
break;
|
||||
}
|
||||
focusItem=null;
|
||||
index++;
|
||||
}
|
||||
return focusItem;
|
||||
}
|
||||
|
||||
this.NavPrev = function(index)
|
||||
{
|
||||
var focusItem;
|
||||
while (1)
|
||||
{
|
||||
var focusName = 'Item'+index;
|
||||
focusItem = document.getElementById(focusName);
|
||||
if (focusItem && focusItem.parentNode.parentNode.style.display=='block')
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (!focusItem) // last element
|
||||
{
|
||||
break;
|
||||
}
|
||||
focusItem=null;
|
||||
index--;
|
||||
}
|
||||
return focusItem;
|
||||
}
|
||||
|
||||
this.ProcessKeys = function(e)
|
||||
{
|
||||
if (e.type == "keydown")
|
||||
{
|
||||
this.repeatOn = false;
|
||||
this.lastKey = e.keyCode;
|
||||
}
|
||||
else if (e.type == "keypress")
|
||||
{
|
||||
if (!this.repeatOn)
|
||||
{
|
||||
if (this.lastKey) this.repeatOn = true;
|
||||
return false; // ignore first keypress after keydown
|
||||
}
|
||||
}
|
||||
else if (e.type == "keyup")
|
||||
{
|
||||
this.lastKey = 0;
|
||||
this.repeatOn = false;
|
||||
}
|
||||
return this.lastKey!=0;
|
||||
}
|
||||
|
||||
this.Nav = function(evt,itemIndex)
|
||||
{
|
||||
var e = (evt) ? evt : window.event; // for IE
|
||||
if (e.keyCode==13) return true;
|
||||
if (!this.ProcessKeys(e)) return false;
|
||||
|
||||
if (this.lastKey==38) // Up
|
||||
{
|
||||
var newIndex = itemIndex-1;
|
||||
var focusItem = this.NavPrev(newIndex);
|
||||
if (focusItem)
|
||||
{
|
||||
var child = this.FindChildElement(focusItem.parentNode.parentNode.id);
|
||||
if (child && child.style.display == 'block') // children visible
|
||||
{
|
||||
var n=0;
|
||||
var tmpElem;
|
||||
while (1) // search for last child
|
||||
{
|
||||
tmpElem = document.getElementById('Item'+newIndex+'_c'+n);
|
||||
if (tmpElem)
|
||||
{
|
||||
focusItem = tmpElem;
|
||||
}
|
||||
else // found it!
|
||||
{
|
||||
break;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (focusItem)
|
||||
{
|
||||
focusItem.focus();
|
||||
}
|
||||
else // return focus to search field
|
||||
{
|
||||
parent.document.getElementById("MSearchField").focus();
|
||||
}
|
||||
}
|
||||
else if (this.lastKey==40) // Down
|
||||
{
|
||||
var newIndex = itemIndex+1;
|
||||
var focusItem;
|
||||
var item = document.getElementById('Item'+itemIndex);
|
||||
var elem = this.FindChildElement(item.parentNode.parentNode.id);
|
||||
if (elem && elem.style.display == 'block') // children visible
|
||||
{
|
||||
focusItem = document.getElementById('Item'+itemIndex+'_c0');
|
||||
}
|
||||
if (!focusItem) focusItem = this.NavNext(newIndex);
|
||||
if (focusItem) focusItem.focus();
|
||||
}
|
||||
else if (this.lastKey==39) // Right
|
||||
{
|
||||
var item = document.getElementById('Item'+itemIndex);
|
||||
var elem = this.FindChildElement(item.parentNode.parentNode.id);
|
||||
if (elem) elem.style.display = 'block';
|
||||
}
|
||||
else if (this.lastKey==37) // Left
|
||||
{
|
||||
var item = document.getElementById('Item'+itemIndex);
|
||||
var elem = this.FindChildElement(item.parentNode.parentNode.id);
|
||||
if (elem) elem.style.display = 'none';
|
||||
}
|
||||
else if (this.lastKey==27) // Escape
|
||||
{
|
||||
parent.searchBox.CloseResultsWindow();
|
||||
parent.document.getElementById("MSearchField").focus();
|
||||
}
|
||||
else if (this.lastKey==13) // Enter
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
this.NavChild = function(evt,itemIndex,childIndex)
|
||||
{
|
||||
var e = (evt) ? evt : window.event; // for IE
|
||||
if (e.keyCode==13) return true;
|
||||
if (!this.ProcessKeys(e)) return false;
|
||||
|
||||
if (this.lastKey==38) // Up
|
||||
{
|
||||
if (childIndex>0)
|
||||
{
|
||||
var newIndex = childIndex-1;
|
||||
document.getElementById('Item'+itemIndex+'_c'+newIndex).focus();
|
||||
}
|
||||
else // already at first child, jump to parent
|
||||
{
|
||||
document.getElementById('Item'+itemIndex).focus();
|
||||
}
|
||||
}
|
||||
else if (this.lastKey==40) // Down
|
||||
{
|
||||
var newIndex = childIndex+1;
|
||||
var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex);
|
||||
if (!elem) // last child, jump to parent next parent
|
||||
{
|
||||
elem = this.NavNext(itemIndex+1);
|
||||
}
|
||||
if (elem)
|
||||
{
|
||||
elem.focus();
|
||||
}
|
||||
}
|
||||
else if (this.lastKey==27) // Escape
|
||||
{
|
||||
parent.searchBox.CloseResultsWindow();
|
||||
parent.document.getElementById("MSearchField").focus();
|
||||
}
|
||||
else if (this.lastKey==13) // Enter
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function setKeyActions(elem,action)
|
||||
{
|
||||
elem.setAttribute('onkeydown',action);
|
||||
elem.setAttribute('onkeypress',action);
|
||||
elem.setAttribute('onkeyup',action);
|
||||
}
|
||||
|
||||
function setClassAttr(elem,attr)
|
||||
{
|
||||
elem.setAttribute('class',attr);
|
||||
elem.setAttribute('className',attr);
|
||||
}
|
||||
|
||||
function createResults()
|
||||
{
|
||||
var results = document.getElementById("SRResults");
|
||||
for (var e=0; e<searchData.length; e++)
|
||||
{
|
||||
var id = searchData[e][0];
|
||||
var srResult = document.createElement('div');
|
||||
srResult.setAttribute('id','SR_'+id);
|
||||
setClassAttr(srResult,'SRResult');
|
||||
var srEntry = document.createElement('div');
|
||||
setClassAttr(srEntry,'SREntry');
|
||||
var srLink = document.createElement('a');
|
||||
srLink.setAttribute('id','Item'+e);
|
||||
setKeyActions(srLink,'return searchResults.Nav(event,'+e+')');
|
||||
setClassAttr(srLink,'SRSymbol');
|
||||
srLink.innerHTML = searchData[e][1][0];
|
||||
srEntry.appendChild(srLink);
|
||||
if (searchData[e][1].length==2) // single result
|
||||
{
|
||||
srLink.setAttribute('href',searchData[e][1][1][0]);
|
||||
if (searchData[e][1][1][1])
|
||||
{
|
||||
srLink.setAttribute('target','_parent');
|
||||
}
|
||||
var srScope = document.createElement('span');
|
||||
setClassAttr(srScope,'SRScope');
|
||||
srScope.innerHTML = searchData[e][1][1][2];
|
||||
srEntry.appendChild(srScope);
|
||||
}
|
||||
else // multiple results
|
||||
{
|
||||
srLink.setAttribute('href','javascript:searchResults.Toggle("SR_'+id+'")');
|
||||
var srChildren = document.createElement('div');
|
||||
setClassAttr(srChildren,'SRChildren');
|
||||
for (var c=0; c<searchData[e][1].length-1; c++)
|
||||
{
|
||||
var srChild = document.createElement('a');
|
||||
srChild.setAttribute('id','Item'+e+'_c'+c);
|
||||
setKeyActions(srChild,'return searchResults.NavChild(event,'+e+','+c+')');
|
||||
setClassAttr(srChild,'SRScope');
|
||||
srChild.setAttribute('href',searchData[e][1][c+1][0]);
|
||||
if (searchData[e][1][c+1][1])
|
||||
{
|
||||
srChild.setAttribute('target','_parent');
|
||||
}
|
||||
srChild.innerHTML = searchData[e][1][c+1][2];
|
||||
srChildren.appendChild(srChild);
|
||||
}
|
||||
srEntry.appendChild(srChildren);
|
||||
}
|
||||
srResult.appendChild(srEntry);
|
||||
results.appendChild(srResult);
|
||||
}
|
||||
}
|
||||
|
||||
function init_search()
|
||||
{
|
||||
var results = document.getElementById("MSearchSelectWindow");
|
||||
for (var key in indexSectionLabels)
|
||||
{
|
||||
var link = document.createElement('a');
|
||||
link.setAttribute('class','SelectItem');
|
||||
link.setAttribute('onclick','searchBox.OnSelectItem('+key+')');
|
||||
link.href='javascript:void(0)';
|
||||
link.innerHTML='<span class="SelectionMark"> </span>'+indexSectionLabels[key];
|
||||
results.appendChild(link);
|
||||
}
|
||||
searchBox.OnSelectItem(0);
|
||||
}
|
||||
/* @license-end */
|
After Width: | Height: | Size: 567 B |
After Width: | Height: | Size: 158 B |
After Width: | Height: | Size: 553 B |
@ -0,0 +1,12 @@
|
||||
var indexSectionsWithContent =
|
||||
{
|
||||
};
|
||||
|
||||
var indexSectionNames =
|
||||
{
|
||||
};
|
||||
|
||||
var indexSectionLabels =
|
||||
{
|
||||
};
|
||||
|
After Width: | Height: | Size: 314 B |
After Width: | Height: | Size: 853 B |
After Width: | Height: | Size: 845 B |
After Width: | Height: | Size: 142 B |
After Width: | Height: | Size: 169 B |
After Width: | Height: | Size: 177 B |
After Width: | Height: | Size: 184 B |
@ -0,0 +1,82 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>TP1: tp1.h Source File</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">TP1
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">tp1.h</div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="preprocessor">#include <stdio.h></span></div>
|
||||
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>  </div>
|
||||
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="keywordtype">void</span> Bonjour (<span class="keywordtype">void</span>);</div>
|
||||
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="keywordtype">void</span> Bonjourv1(<span class="keywordtype">void</span>);</div>
|
||||
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="keywordtype">void</span> CalculRed(<span class="keywordtype">void</span>);</div>
|
||||
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="keywordtype">void</span> Viennoiserie(<span class="keywordtype">void</span>);</div>
|
||||
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="keywordtype">void</span> Caracteres(<span class="keywordtype">void</span>);</div>
|
||||
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="keywordtype">void</span> Majuscule(<span class="keywordtype">void</span>);</div>
|
||||
</div><!-- fragment --></div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
|
||||
</small></address>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,12 @@
|
||||
#include "tp1.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
//Bonjour();
|
||||
//Bonjourv1();
|
||||
//CalculRed();
|
||||
//Viennoiserie();
|
||||
//Caracteres();
|
||||
Majuscule();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
/**
|
||||
*/file tp1.c
|
||||
*\brief Ce fichier permet de réaliser le tp1 datant du 09.09.22 avec les exercices 1, 2 et 3 de la partie 2 et le 4 et 6 de la partie 1.
|
||||
Amusez-vous bien !!!
|
||||
*\author Antoine PEREDERII
|
||||
*\date 09 Septembre 2022
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "tp1.h"
|
||||
|
||||
void Bonjour(void)
|
||||
{
|
||||
printf("Bonjour\n");
|
||||
}
|
||||
/**
|
||||
* \brief affiche l'année qu'on lui a donnée
|
||||
*/
|
||||
void Bonjourv1(void)
|
||||
{
|
||||
int annee;
|
||||
printf("veuillez saisir une année :");
|
||||
scanf("%d", &annee);
|
||||
printf("Bonjour,\nNous somme en %d.", annee);
|
||||
}
|
||||
|
||||
void CalculRed(void)
|
||||
{
|
||||
float Prix, PrixTot;
|
||||
int Reduction;
|
||||
printf("Veuillez entrer un prix :");
|
||||
scanf("%f", &Prix);
|
||||
printf("Quelle est la réduction :");
|
||||
scanf("%d", &Reduction);
|
||||
PrixTot = Prix *(1-((Reduction)/100.0));
|
||||
printf("Le prix après la réduction est donc de %.2f\n", PrixTot);
|
||||
|
||||
}
|
||||
|
||||
void Viennoiserie(void)
|
||||
{
|
||||
int NbrDeVienne, offerts, MoyenAchats, PetitAchat;
|
||||
float Prix;
|
||||
printf("Saississez le nombre de viennoiserie :");
|
||||
scanf("%d", &NbrDeVienne);
|
||||
|
||||
offerts=NbrDeVienne/12;
|
||||
MoyenAchats=NbrDeVienne/5;
|
||||
PetitAchat=(NbrDeVienne%5);
|
||||
Prix=MoyenAchats*2.0 + PetitAchat*0.5;
|
||||
|
||||
printf("Le client doit payer %.2f€, et %d viennoiseries lui sont offertes.\n", Prix, offerts);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Caracteres(void)
|
||||
{
|
||||
char carac;
|
||||
printf("saisir un unique caractère en minuscule :");
|
||||
carac = getchar();
|
||||
printf("le caractère saisi est %c\n", carac);
|
||||
printf("la valeur ASCII de ce caractère ets %d\n", carac);
|
||||
}
|
||||
void Majuscule(void)
|
||||
{
|
||||
char caracM;
|
||||
printf("saisir un unique caractère en minuscule :");
|
||||
caracM = getchar() - 32;
|
||||
printf("Le caractère majuscule de cette lettre est %c\n", caracM);
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void Bonjour (void);
|
||||
void Bonjourv1(void);
|
||||
void CalculRed(void);
|
||||
void Viennoiserie(void);
|
||||
void Caracteres(void);
|
||||
void Majuscule(void);
|
@ -0,0 +1,11 @@
|
||||
#include "tp2.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
//LocationSalle();
|
||||
//Aperitif();
|
||||
//Aperitif2();
|
||||
//Banquet();
|
||||
EtudeGlobal();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
#include "tp2.h"
|
||||
|
||||
|
||||
void LocationSalle (void)
|
||||
{
|
||||
float Montant;
|
||||
char Cat, Dec;
|
||||
printf("Quel catégorie de salle voulez-vous prendre (A/B/C) :\n");
|
||||
scanf("%c%*c",&Cat);
|
||||
printf("Voulez-vous la décoration (O/N) :\n");
|
||||
scanf("%c",&Dec);
|
||||
if(Dec == 'O' || Cat == 'o')
|
||||
if(Cat == 'A' || Cat == 'a')
|
||||
Montant = 1500 * (1+(10.0/100));
|
||||
else if(Cat == 'B' || Cat == 'b')
|
||||
Montant = 1000 * (1+(10.0/100));
|
||||
else
|
||||
Montant = 700 *(1+(10.0/100));
|
||||
else
|
||||
if(Cat == 'A' || Cat == 'a')
|
||||
Montant = 1500;
|
||||
else if(Cat == 'B' || Cat == 'b')
|
||||
Montant = 1000;
|
||||
else
|
||||
Montant = 700;
|
||||
|
||||
printf("Le montant est donc de %f€\n", Montant);
|
||||
}
|
||||
|
||||
void Aperitif(void)
|
||||
{
|
||||
float Montant, PrixTot;
|
||||
char Formule;
|
||||
int nbrPers;
|
||||
printf("Quel formule voulez-vous (B/U) :\n");
|
||||
scanf("%c%*c",&Formule);
|
||||
printf("Combien êtes-vous :\n");
|
||||
scanf("%d",&nbrPers);
|
||||
if(Formule == 'B' || Formule == 'b')
|
||||
if(nbrPers <= 50)
|
||||
Montant = 300;
|
||||
else if(nbrPers <= 100)
|
||||
Montant = 500;
|
||||
else
|
||||
Montant = 800;
|
||||
else
|
||||
Montant = nbrPers * 12;
|
||||
|
||||
PrixTot = Montant + 50;
|
||||
printf("Le montant est donc de %f€\n", PrixTot);
|
||||
}
|
||||
|
||||
void Aperitif2(void)
|
||||
{
|
||||
float MontantU, MontantB, PrixTot;
|
||||
char Formule;
|
||||
int nbrPers;
|
||||
printf("Quel formule voulez-vous (B/U) :\n");
|
||||
scanf("%c",&Formule);
|
||||
printf("Combien êtes-vous :\n");
|
||||
scanf("%d",&nbrPers);
|
||||
if(nbrPers <= 50)
|
||||
MontantB = 300;
|
||||
if(nbrPers <= 100 && nbrPers > 50)
|
||||
MontantB = 500;
|
||||
if(nbrPers >100)
|
||||
MontantB = 800;
|
||||
|
||||
MontantU = nbrPers*12;
|
||||
|
||||
if(Formule == 'B' || Formule == 'b')
|
||||
PrixTot = MontantB + 50;
|
||||
else
|
||||
PrixTot = MontantU + 50;
|
||||
|
||||
printf("Le montant est donc de %f€\n", PrixTot);
|
||||
}
|
||||
|
||||
|
||||
void Banquet(void)
|
||||
{
|
||||
float Montant;
|
||||
char Menu;
|
||||
int nbrPers;
|
||||
printf("Quel menu voulez-vous (I/D) :\n");
|
||||
scanf("%c%*c",&Menu);
|
||||
printf("Combien êtes-vous :\n");
|
||||
scanf("%d",&nbrPers);
|
||||
if(Menu == 'I' || Menu == 'i')
|
||||
{
|
||||
if(nbrPers <= 10)
|
||||
Montant = nbrPers * 30;
|
||||
if(nbrPers >10 && nbrPers <= 30)
|
||||
Montant = (nbrPers-10) * 28 +10*30 ;
|
||||
if(nbrPers >30 && nbrPers <= 80)
|
||||
Montant = (nbrPers-30)*27 + 10*30 +20*28;
|
||||
if(nbrPers > 80)
|
||||
Montant = (nbrPers-80)*26 + 10*30 +20*28 +50*27;
|
||||
}
|
||||
else
|
||||
Montant = nbrPers * 31;
|
||||
|
||||
printf("Le montant est donc de %f€\n", Montant);
|
||||
}
|
||||
|
||||
void EtudeGlobal(void)
|
||||
{
|
||||
char Ape, Ban;
|
||||
printf("Voulez-vous un aperitif (O/N) :\n");
|
||||
scanf("%c%*c", &Ape);
|
||||
printf("Voulez-vous un banquet (O/N) :\n");
|
||||
scanf("%c%*c", &Ban);
|
||||
LocationSalle();
|
||||
if (Ape == 'O' || Ape == 'o')
|
||||
{
|
||||
Aperitif();
|
||||
}
|
||||
if (Ban == 'O' || Ban == 'o')
|
||||
{
|
||||
Banquet();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void LocationSalle(void);
|
||||
void Aperitif(void);
|
||||
void Aperitif2(void);
|
||||
void Banquet(void);
|
||||
void EtudeGlobal(void);
|
@ -0,0 +1,34 @@
|
||||
#include "tp3.h"
|
||||
|
||||
void testLocSalle(void)
|
||||
{
|
||||
float cout;
|
||||
char categ, deco;
|
||||
printf("Quelle est la salle (A,B,C) :");
|
||||
scanf("%c%*c", &categ);
|
||||
printf("voulez-vous la deco (O,N) :");
|
||||
scanf("%c%*c", &deco);
|
||||
cout = coutSalle(deco, categ);
|
||||
printf("Catégorie %c Décoration %c Coût %.2f\n",categ, deco, cout);
|
||||
}
|
||||
|
||||
void testApero(void)
|
||||
{
|
||||
float Montant;
|
||||
char Formule;
|
||||
int nbrPers;
|
||||
printf("Quel formule voulez-vous (B/U) :\n");
|
||||
scanf("%c%*c",&Formule);
|
||||
printf("Combien êtes-vous :\n");
|
||||
scanf("%d",&nbrPers);
|
||||
Montant = PrixAperitif(Formule, nbrPers);
|
||||
printf("Le montant est donc de %f€\n", Montant);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
//testLocSalle();
|
||||
//testApero();
|
||||
Global();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
#include "tp3.h"
|
||||
|
||||
|
||||
float coutSalle (char deco, char categ)
|
||||
{
|
||||
float prix;
|
||||
if(deco == 'o' || deco == 'O')
|
||||
if(categ == 'A' || categ == 'a')
|
||||
prix = 1500 *(1+(10.0/100));
|
||||
else if(categ == 'B' || categ == 'b')
|
||||
prix = 1000 *(1+(10.0/100));
|
||||
else prix = 700 *(1+(10.0/100));
|
||||
else
|
||||
if(categ == 'A' || categ == 'a')
|
||||
prix = 1500;
|
||||
else if(categ == 'B' || categ == 'b')
|
||||
prix = 1000;
|
||||
else prix = 700;
|
||||
return prix;
|
||||
}
|
||||
|
||||
float PrixAperitif(char Formule, int nbrPers)
|
||||
{
|
||||
float Montant, PrixTot;
|
||||
if(Formule == 'B' || Formule == 'b')
|
||||
if(nbrPers <= 50)
|
||||
Montant = 300;
|
||||
else if(nbrPers <= 100)
|
||||
Montant = 500;
|
||||
else
|
||||
Montant = 800;
|
||||
else
|
||||
Montant = nbrPers * 12;
|
||||
|
||||
PrixTot = Montant + 50;
|
||||
return PrixTot;
|
||||
}
|
||||
|
||||
void faffichage (float cout, float Montant, float coutTot)
|
||||
{
|
||||
printf("Location de Salle : %.2f\nApéritif :\t%.2f\nTotal : \t%.2f\n", cout, Montant, coutTot);
|
||||
}
|
||||
|
||||
void Global (void)
|
||||
{
|
||||
float cout, Montant, coutTot;
|
||||
char categ, deco, Formule, Apero;
|
||||
int nbrPers;
|
||||
printf("Quelle est la salle (A,B,C) :");
|
||||
scanf("%c%*c", &categ);
|
||||
printf("voulez-vous la deco (O,N) :");
|
||||
scanf("%c%*c", &deco);
|
||||
printf("Voulez-vous un aperitif (O,N) :");
|
||||
scanf("%c%*c", &Apero);
|
||||
if(Apero == 'O' || Apero == 'o')
|
||||
{
|
||||
printf("Quel formule voulez-vous (B/U) :");
|
||||
scanf("%c%*c",&Formule);
|
||||
printf("Combien êtes-vous :");
|
||||
scanf("%d",&nbrPers);
|
||||
Montant = PrixAperitif(Formule, nbrPers);
|
||||
}
|
||||
else Montant = 0;
|
||||
cout = coutSalle(deco, categ);
|
||||
coutTot = Montant + cout;
|
||||
faffichage(cout, Montant, coutTot);
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
float coutSalle (char categ, char deco);
|
||||
float PrixAperitif(char Formule, int nbrPers);
|
||||
void faffichage (float cout, float Montant, float coutTot);
|
||||
void Global (void);
|
@ -0,0 +1,88 @@
|
||||
|
||||
|
||||
float coutLogement (char type, int nbPers, char pension)
|
||||
{
|
||||
float prix;
|
||||
int nbChambres;
|
||||
if(type == 'A' || type == 'a')
|
||||
if(nbPers <= 4)
|
||||
prix = 800;
|
||||
else prix = 800 + (nbPers-4)*((800*10.0)/100);
|
||||
else
|
||||
{
|
||||
nbChambres = nbPers/3;
|
||||
if(nbPers % 3 != 0)
|
||||
nbChambres = nbChambres + 1;
|
||||
prix = nbChambres * 230;
|
||||
if(pension == 'd' || pension == 'D')
|
||||
prix = prix + 120 * nbPers;
|
||||
else prix = prix + 210 * nbPers;
|
||||
|
||||
return prix;
|
||||
}
|
||||
|
||||
// Activité ski //
|
||||
|
||||
int saisirActiviteSki(int *nbPers, int *nbPack, int *nbSki)
|
||||
{
|
||||
int *nbPers, *nbPack, *nbSki;
|
||||
printf("Nombre de personnes ayant choisie l'activité ski :");
|
||||
scanf("%d", *nbPers);
|
||||
printf("Nombre de packs de ski :");
|
||||
scanf("%d", *nbPack);
|
||||
printf("Nombre de ski seuls :");
|
||||
scanf("%d", *nbSki);
|
||||
if(nbPers < (nbPack + nbSki))
|
||||
printf(pb : nombre de personnes et de matériels non cohérents, activité non validée)
|
||||
}
|
||||
float coutActiviteSki(in nbPers, int nbPack, int nbSki, float *reduc)
|
||||
{
|
||||
float prixS;
|
||||
prixS = nbPers*150 + nbPack*120 + nbSki*80
|
||||
reduc =
|
||||
|
||||
return prixS;
|
||||
}
|
||||
|
||||
// fonction totale //
|
||||
|
||||
void globale (int nbPers, int nbPack, int nbSki, float reduc)
|
||||
{
|
||||
float prixS, prix, prixTot;
|
||||
char Ski;
|
||||
printf("Voulez vous faire du ski (O, N) :")
|
||||
scanf("%c%*c", &Ski);
|
||||
saisirLogement();
|
||||
if()
|
||||
prix = coutLogement(type, nbPers, pension);
|
||||
if(Ski == 'O' || Ski == 'o');
|
||||
{
|
||||
saisirActiviteSki();
|
||||
prixS = coutActiviteSki(in nbPers, int nbPack, int nbSki);
|
||||
prixSR = prixS - reduc;
|
||||
prixTot = prix + (prixS - reduc);
|
||||
printf("Coût logement : %.2f\n Côut activité ski : %.2f\n Montant reduction ski : %.2f\n Total : %.2f\n", prix, prixS, reduc, prixTot);
|
||||
}
|
||||
else
|
||||
printf("Total : %.2f\n", prixTot);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void testCoutLogement (char type, int nbPers, char pension, float prix)
|
||||
{
|
||||
float prix;
|
||||
saisirLogement();
|
||||
if()
|
||||
prix = coutLogement(type, nbPers, pension);
|
||||
printf("type de logement : %c nb de personnes : %c pension : %c coût : %.2f\n", type, nbPers, pension, prix);
|
||||
}
|
||||
|
||||
void testCoutActiviteSki (int nbPers, int nbPack, int nbSki, float reduc)
|
||||
{
|
||||
float prixS;
|
||||
saisirActiviteSki();
|
||||
prixS = coutActiviteSki(in nbPers, int nbPack, int nbSki);
|
||||
prixSR = prixS - reduc;
|
||||
printf("cout ss reduc : %.2f Reduc : %.2f cout reduc comprise : %.2f\n", prixS, reduc, prixSR);
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
#include "tp4.h"
|
||||
|
||||
void testSaisirLogement (void)
|
||||
{
|
||||
int nbPers, resultat;
|
||||
char type, pension;
|
||||
resultat = saisirLogement(&type, &nbPers, &pension);
|
||||
if(resultat == 0)
|
||||
printf("Logement : %c\n",type);
|
||||
printf("nb de Personnes : %d\n", nbPers);
|
||||
if(type == 'B')
|
||||
printf("pension : %c\n", pension);
|
||||
else printf("pension : non\n");
|
||||
}
|
||||
|
||||
void testCoutLogement (void)
|
||||
{
|
||||
char type, pension;
|
||||
int nbPers, resultat;
|
||||
float prix;
|
||||
resultat = saisirLogement(&type, &nbPers, &pension);
|
||||
if(resultat == 0)
|
||||
{
|
||||
prix = coutLogement(type, nbPers, pension);
|
||||
printf("type de logement : %c nb Personnes : %d ", type, nbPers);
|
||||
if(type == 'B' || type == 'b')
|
||||
printf("pension : %c ", pension);
|
||||
else printf("pension : non ");
|
||||
printf("cout : %.2f\n", prix);
|
||||
}
|
||||
}
|
||||
|
||||
void testSki(void)
|
||||
{
|
||||
int nbPers, nbPack, nbSki, resultat;
|
||||
char rep;
|
||||
resultat = saisirActiviteSki(&nbPers, &nbPack, &nbSki);
|
||||
if(resultat == 0)
|
||||
{
|
||||
printf("nb Personnes : %d nbPack : %d nbSki : %d\n",nbPers, nbPack, nbSki);
|
||||
}
|
||||
}
|
||||
|
||||
void testCoutActiviteSki(void)
|
||||
{
|
||||
int nbPers, nbPack, nbSki, resultat;
|
||||
float reduc, prix;
|
||||
resultat = saisirActiviteSki(&nbPers, &nbPack, &nbSki);
|
||||
if(resultat == 0)
|
||||
{
|
||||
prix = coutActiviteSki(nbPers, nbPack, nbSki, &reduc);
|
||||
printf("nb Personnes : %d nbPack : %d nbSki : %d prix : %.2f\n",nbPers, nbPack, nbSki, prix);
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
//testSaisirLogement();
|
||||
//testCoutLogement();
|
||||
//testSki();
|
||||
testCoutActiviteSki();
|
||||
//globale(int nbPers, int nbPack, int nbSki, float reduc);
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
#include "tp4.h"
|
||||
|
||||
// Location du logement //
|
||||
|
||||
int saisirLogement(char *type, int *nbPers, char *pension)
|
||||
{
|
||||
printf("Quel logement voulez vous ? (A, B) :");
|
||||
scanf("%c%*c", type);
|
||||
printf("nb de Pers :");
|
||||
scanf("%d%*c", nbPers);
|
||||
if(*type == 'B')
|
||||
{
|
||||
printf("Quel pension avez vous ? (C, D) :");
|
||||
scanf("%c%*c", pension);
|
||||
}
|
||||
if(*type == 'A')
|
||||
{
|
||||
if(*nbPers > 6)
|
||||
{
|
||||
printf("pb : nb de personnes non cohérent, location refusé.\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
float coutLogement (char type, int nbPers, char pension)
|
||||
{
|
||||
float prix;
|
||||
int nbChambres;
|
||||
if(type == 'A' || type == 'a')
|
||||
if(nbPers <= 4)
|
||||
prix = 800;
|
||||
else prix = 800 + (nbPers-4)*((800*10.0)/100);
|
||||
else
|
||||
{
|
||||
nbChambres = nbPers/3;
|
||||
if(nbPers % 3 != 0)
|
||||
nbChambres = nbChambres + 1;
|
||||
prix = nbChambres * 230;
|
||||
if(pension == 'd' || pension == 'D')
|
||||
prix = prix + 120 * nbPers;
|
||||
else prix = prix + 210 * nbPers;
|
||||
|
||||
return prix;
|
||||
}
|
||||
}
|
||||
|
||||
// Activité ski //
|
||||
|
||||
int saisirActiviteSki(int *nbPers, int *nbPack, int *nbSki)
|
||||
{
|
||||
char rep;
|
||||
printf("Nombre de personnes ayant choisie l'activité ski :");
|
||||
scanf("%d%*c", nbPers);
|
||||
printf("Voulez vous du matos ??? (O, N) :");
|
||||
scanf("%c%*c", &rep);
|
||||
if(rep == 'O' || rep == 'o')
|
||||
{
|
||||
printf("Nb de pack ski : ");
|
||||
scanf("%d%*c", nbPack);
|
||||
printf("Nombre de ski seuls :");
|
||||
scanf("%d%*c", nbSki);
|
||||
if((*nbPack + *nbSki) > *nbPers)
|
||||
{
|
||||
printf("pb : nombre de personnes et de matériels non cohérents, activité non validée.\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*nbPack = 0;
|
||||
*nbSki = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
float coutActiviteSki(int nbPers, int nbPack, int nbSki, float *reduc)
|
||||
{
|
||||
float forfaitPistes, prixLocMateriel, totalMateriel, coutActiviteSkiSansReduction;
|
||||
forfaitPistes = nbPers * 150;
|
||||
coutActiviteSkiSansReduction = forfaitPistes + nbPack*120 + nbSki*80;
|
||||
totalMateriel = nbPack + nbSki;
|
||||
|
||||
if(totalMateriel <= 3)
|
||||
*reduc = 0;
|
||||
else
|
||||
if(nbPack <= 3)
|
||||
*reduc = (totalMateriel - 3)*80*(50.0/100);
|
||||
else *reduc = ((nbPack-3)*120 + nbSki * 80) * (50.0/100);
|
||||
|
||||
return coutActiviteSkiSansReduction;
|
||||
}
|
||||
|
||||
// fonction totale //
|
||||
|
||||
void globale (void)
|
||||
{
|
||||
int nbPers, nbPack, nbSki, resultat;
|
||||
float reduc, prix;
|
||||
float prixS, prix, prixTot;
|
||||
char Ski;
|
||||
printf("Voulez vous faire du ski (O, N) :")
|
||||
scanf("%c%*c", &Ski);
|
||||
saisirLogement();
|
||||
if()
|
||||
prix = coutLogement(type, nbPers, pension);
|
||||
if(Ski == 'O' || Ski == 'o');
|
||||
{
|
||||
saisirActiviteSki();
|
||||
prixS = coutActiviteSki(in nbPers, int nbPack, int nbSki);
|
||||
prixSR = prixS - reduc;
|
||||
prixTot = prix + (prixS - reduc);
|
||||
printf("Coût logement : %.2f\n Côut activité ski : %.2f\n Montant reduction ski : %.2f\n Total : %.2f\n", prix, prixS, reduc, prixTot);
|
||||
}
|
||||
else
|
||||
printf("Total : %.2f\n", prixTot);
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int saisirLogement(char *type, int *nbPers, char *pension);
|
||||
float coutLogement (char type, int nbPers, char pension);
|
||||
int saisirActiviteSki(int *nbPers, int *nbPack, int *nbSki);
|
||||
float coutActiviteSki(int nbPers, int nbPack, int nbSki, float *reduc);
|
||||
//void globale (int nbPers, int nbPack, int nbSki, float reduc):
|
@ -0,0 +1,7 @@
|
||||
1262 4 12 12 22 18
|
||||
4384 2 15 17
|
||||
1340 0
|
||||
1987 3 22 13 15
|
||||
1005 0
|
||||
2009 2 18 12
|
||||
1010 2 11 15
|
@ -0,0 +1,28 @@
|
||||
#include "tp5.h"
|
||||
|
||||
void testSaisieEmployeNbreFormations(void)
|
||||
{
|
||||
int idEmp, nbForm;
|
||||
saisieEmployeNbreFormatrions(&idEmp, &nbForm);
|
||||
printf("identifiant : %d nombre de Formations : %d\n", idEmp, nbForm);
|
||||
}
|
||||
|
||||
void testsaisieControleeIemeFormation(void)
|
||||
{
|
||||
int i, res;
|
||||
printf("quel est la formation :");
|
||||
scanf("%d", &i);
|
||||
res = saisieControleeIemeFormation(i);
|
||||
printf("%d", res);
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
//testSaisieEmployeNbreFormations();
|
||||
//testsaisieControleeIemeFormation();
|
||||
//enregistrementEmployeNbreFormations();
|
||||
traitementFichierEmployes();
|
||||
//saisieEmployeNbreFormatrions();
|
||||
//saisieControleeIemeFormation();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
void saisieEmployeNbreFormatrions(int *idEmp, int *nbForm)
|
||||
{
|
||||
FILE *flot;
|
||||
flot = fopen("donneesEmployes.txt", "r");
|
||||
if(flot == NULL)
|
||||
{
|
||||
printf("Pb d'ouverture du fichier donneesEmployes.txt\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("Veuillez saisir votre identifiant :");
|
||||
scanf("%d", idEmp);
|
||||
printf("identifiant de l'employé : %d\n", idEmp);
|
||||
while(*idEmp < 1000 || *idEmp > 9999)
|
||||
{
|
||||
printf("identifiant d'employé incorrect, il doit être à 4 chiffrres. Re-saisir : ");
|
||||
scanf("%d", idEmp);
|
||||
printf("%d\n", idEmp);
|
||||
}
|
||||
fscanf(flot, "%d%d", &idEmp, &nbForm);
|
||||
printf("nombre de formations choisies : %d", nbForm);
|
||||
while(*nbForm > 0 || *nbForm <= 10)
|
||||
{
|
||||
printf("nombre de formations incorrect, il doit être entre 0 et 10 compris. Re-saisir : ");
|
||||
scanf("%d", &nbForm);
|
||||
printf("%d\n", nbForm);
|
||||
}
|
||||
}1021 81010 2121010 2121010 212151010 2 12 16
|
||||
1010 3 12 11 14
|
@ -0,0 +1,119 @@
|
||||
#include "tp5.h"
|
||||
|
||||
void saisieEmployeNbreFormatrions(int *idEmp, int *nbForm)
|
||||
{
|
||||
printf("Veuillez saisir votre identifiant :");
|
||||
scanf("%d", idEmp);
|
||||
printf("identifiant de l'employé : %d\n", *idEmp);
|
||||
while(*idEmp < 1000 || *idEmp > 9999)
|
||||
{
|
||||
printf("identifiant d'employé incorrect, il doit être à 4 chiffrres. Re-saisir : ");
|
||||
scanf("%d", idEmp);
|
||||
printf("%d\n", *idEmp);
|
||||
}
|
||||
printf("Veuillez saisir le nombre de formations :");
|
||||
scanf("%d", nbForm);
|
||||
printf("nombre de formations choisies : %d\n", *nbForm);
|
||||
while(*nbForm < 0 || *nbForm > 10)
|
||||
{
|
||||
printf("nombre de formations incorrect, il doit être entre 0 et 10 compris. Re-saisir : ");
|
||||
scanf("%d", nbForm);
|
||||
printf("nombre de formations choisies : %d\n", *nbForm);
|
||||
}
|
||||
}
|
||||
|
||||
int saisieControleeIemeFormation(int i)
|
||||
{
|
||||
int idForm;
|
||||
printf("Veuillez saisir l'identifiant de la %dème formation :", i);
|
||||
scanf("%d", &idForm);
|
||||
while(((idForm/10)<1 || (idForm/10) >5) || ((idForm%10) < 1 || (idForm%10) > 8))
|
||||
{
|
||||
printf("identifiant de la %dème formation incorrect, il doit être à 2 chiffrres. Re-saisir : ", i);
|
||||
scanf("%d", &idForm);
|
||||
printf("identifiant de la %dème formations choisies correct : %d\n", i, idForm);
|
||||
}
|
||||
return idForm;
|
||||
}
|
||||
|
||||
void enregistrementEmployeNbreFormations(void)
|
||||
{
|
||||
int idEmp, nbForm, i = 1, idForm;
|
||||
FILE *f;
|
||||
f = fopen("donneesEmployes.txt", "a");
|
||||
if(f == NULL)
|
||||
{
|
||||
printf("erreur d'ouverture du fichier");
|
||||
exit(1);
|
||||
}
|
||||
saisieEmployeNbreFormatrions(&idEmp, &nbForm);
|
||||
fprintf(f, "\n%d %d ", idEmp, nbForm);
|
||||
while(i < (nbForm+1))
|
||||
{
|
||||
idForm = saisieControleeIemeFormation(i);
|
||||
fprintf(f, "%d ", idForm);
|
||||
i = i + 1;
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void traitementFichierEmployes(void)
|
||||
{
|
||||
FILE *f;
|
||||
int idEmp, nbForm, i = 1, idForm;
|
||||
f = fopen("donneesEmployes.txt", "r");
|
||||
if(f == NULL)
|
||||
{
|
||||
printf("erreur d'ouverture du fichier");
|
||||
exit(1);
|
||||
}
|
||||
while(!feof(f))
|
||||
{
|
||||
printf("identifiant de l'employé : %d\n", idEmp);
|
||||
printf("nombre de formations choisies : %d\n", nbForm);
|
||||
if(nbForm > 0)
|
||||
{
|
||||
while(i < (nbForm+1))
|
||||
{
|
||||
fscanf(f, "%d", &idForm);
|
||||
printf("identifiant de la %dème formations choisies correct : %d\n", i, idForm);
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
||||
i = 1;
|
||||
printf("nombre d'employé qui n'ont pas suivie de formations :")
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
void affiche1Categ(int numCateg, int nbThem)
|
||||
{
|
||||
int i = 1;
|
||||
printf("Categorie %d : ", numCateg);
|
||||
while(i < (nbThem+1))
|
||||
{
|
||||
printf("%d ", i);
|
||||
i = i + 1;
|
||||
}
|
||||
printf("");
|
||||
}
|
||||
|
||||
int afficheFormationProposees(void)
|
||||
{
|
||||
//affiche les identifiants de toutes les formations proposées cette année par l'entreprise
|
||||
//cette fonction li le fichier formation.txt afin de réaliser cet affichage et retourne un code : (-1) si problème ou 1 sinon
|
||||
FILE *f;
|
||||
int numCateg, nbThem, i = 1;
|
||||
f = fopen("formation.txt", "r");
|
||||
if(f == NULL)
|
||||
{
|
||||
printf("erreur d'ouverture du fichier");
|
||||
exit(1);
|
||||
}
|
||||
while(!feof(f))
|
||||
{
|
||||
fscanf(f, "%d %d", &numCateg, &nbThem);
|
||||
affiche1Categ(numCateg, nbThem);
|
||||
}
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void saisieEmployeNbreFormatrions(int *idEmp, int *nbForm);
|
||||
int saisieControleeIemeFormation(int i);
|
||||
void testSaisieEmployeNbreFormations(void);
|
||||
void testsaisieControleeIemeFormation(void);
|
||||
void enregistrementEmployeNbreFormations(void);
|
||||
void traitementFichierEmployes(void);
|
@ -0,0 +1,125 @@
|
||||
#include "tp5.h"
|
||||
|
||||
void saisieEmployeNbreFormations(int *idEmp, int *nbForm) {
|
||||
printf("Saisir identifiant de l'employé: ");
|
||||
while (1) {
|
||||
scanf("%d%*c", idEmp);
|
||||
if (*idEmp < 1000 || *idEmp > 9999) {
|
||||
printf("identifiant d'employé incorrect: il doit être à 4 chiffres, re saisir: ");
|
||||
} else break;
|
||||
}
|
||||
printf("Saisir nombre de formation: ");
|
||||
while (1) {
|
||||
scanf("%d%*c", nbForm);
|
||||
if (*nbForm < 0 || *nbForm > 10) {
|
||||
printf("nombre de formations incorrect, il doit être entre 0 et 10 compris, re saisir: ");
|
||||
} else break;
|
||||
}
|
||||
}
|
||||
|
||||
int saisieControleeIemeFormation(int i) {
|
||||
int id;
|
||||
printf("identifiant de la formation %d:", i);
|
||||
while(1) {
|
||||
scanf("%d%*c", &id);
|
||||
if (id >= 100 || id < 10) {
|
||||
printf("identifiant doit avoir 2 chiffres, re-saisir: ");
|
||||
continue;
|
||||
}
|
||||
|
||||
int c1 = id / 10;
|
||||
int c2 = id - (10 * c1);
|
||||
if (c1 < 1 || c1 > 5) {
|
||||
printf("premier chiffre de l'identifiant (%d) doit être compris entre 1 et 5 compris, re-saisir: ", c1);
|
||||
continue;
|
||||
}
|
||||
if (c2 < 1 || c2 > 8){
|
||||
printf("deuxieme chiffre de l'identifiant (%d) doit être compris entre 1 et 8 compris, re-saisir: ", c2);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
void enregistrementEmployee(FILE *flot) {
|
||||
int idEmp = 0, nbForm = 0;
|
||||
saisieEmployeNbreFormations(&idEmp, &nbForm);
|
||||
fprintf(flot, "%d %d", idEmp, nbForm);
|
||||
if (nbForm > 0) fprintf(flot, " ");
|
||||
for (int i = 1; i <= nbForm; i++) {
|
||||
int id = saisieControleeIemeFormation(i);
|
||||
fprintf(flot, " %d", id);
|
||||
i++;
|
||||
}
|
||||
fprintf(flot, "\n");
|
||||
}
|
||||
|
||||
void enregistrementEmployees(void) {
|
||||
FILE* flot = fopen("/home/UCA/mabatista1/algo/tp5/donneeEmployees.txt", "w");
|
||||
char c;
|
||||
while(1) {
|
||||
enregistrementEmployee(flot);
|
||||
printf("Voulez-vous un autre saisie ? (O/N)");
|
||||
scanf("%c", &c);
|
||||
if (c != 'O') break;
|
||||
}
|
||||
fclose(flot);
|
||||
}
|
||||
|
||||
void traitementFichierEmployees(int idForm) {
|
||||
FILE *flot = fopen("/home/UCA/mabatista1/algo/tp5/donneeEmployees.txt","r");
|
||||
int idEmp, nbForm;
|
||||
if (!fscanf(flot, "%d%d", &idEmp, &nbForm)) {
|
||||
printf("il n'y a pas d'emplyés dans le fichier !");
|
||||
return;
|
||||
}
|
||||
printf("Les employés qui ont suivit la formation %d sont:\n", idForm);
|
||||
int nbEmployes = 0, someNombresFormations =0, max = 0, nbSansForm = 0;
|
||||
while(!feof(flot)) {
|
||||
int i = 0;
|
||||
int idFormEmp = 0;
|
||||
while(i < nbForm) {
|
||||
fscanf(flot, "%d", &idFormEmp);
|
||||
if (idFormEmp == idForm)
|
||||
printf("\temployé n° %d\n", idEmp);
|
||||
i++;
|
||||
}
|
||||
if (nbForm > max) max = nbForm;
|
||||
if (nbForm == 0) nbSansForm++;
|
||||
someNombresFormations += nbForm;
|
||||
nbEmployes++;
|
||||
|
||||
fscanf(flot, "%d %d", &idEmp, &nbForm);
|
||||
}
|
||||
fclose(flot);
|
||||
printf("Statistiques: \n");
|
||||
printf("\tNombre max de formations réellement suivies par employé: %d\n", max);
|
||||
printf("\tNombre d'employés sans formation: %d\n", nbSansForm);
|
||||
printf("\tNombre moyen de formation par employés: %.2f\n", (float) someNombresFormations / nbEmployes);
|
||||
}
|
||||
|
||||
void afficherFormations(int idx, int nb) {
|
||||
for (int i = 1; i < nb + 1; i++)
|
||||
printf("%d%d ", idx, i);
|
||||
if (nb > 0) printf("\n");
|
||||
}
|
||||
|
||||
|
||||
void formations(void) {
|
||||
FILE* flot = fopen("/home/UCA/mabatista1/algo/tp5/formations.txt", "r");
|
||||
int nb = 0;
|
||||
if (!fscanf(flot, "%d", &nb)) {
|
||||
printf("Le fichier est vide !");
|
||||
}
|
||||
int idx = 0;
|
||||
while(!feof(flot)) {
|
||||
afficherFormations(++idx, nb);
|
||||
fscanf(flot, "%d", &nb);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void globale(void) {
|
||||
formations();
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
18 20
|
||||
20 22
|
||||
25 27
|
@ -0,0 +1,20 @@
|
||||
#include "tp6.h"
|
||||
|
||||
void testRemplir(void)
|
||||
{
|
||||
int max, res;
|
||||
int tMatieres[150] = {0}, tCoeff[150] = {0};
|
||||
printf("Donnez une valeur physique pour le tableau :");
|
||||
scanf("%d", &max);
|
||||
res = remplirTableaux(tMatieres, tCoeff, max);
|
||||
printf("res : %d\n", res);
|
||||
}
|
||||
|
||||
|
||||
int main (void)
|
||||
{
|
||||
//testRemplir();
|
||||
gestionMatieres();
|
||||
//remplirTableaux();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,191 @@
|
||||
#include "tp6.h"
|
||||
|
||||
int remplirTableaux(int tMatieres[],int tCoeff[],int max)
|
||||
{
|
||||
int nMatieres, coeff, i = 0;
|
||||
FILE *flot;
|
||||
flot = fopen("matieres.txt", "r");
|
||||
if(flot == NULL)
|
||||
{
|
||||
printf("Pb d'ouverture du fichier matieres.txt\n");
|
||||
return -1;
|
||||
}
|
||||
fscanf(flot, "%d%d", &nMatieres, &coeff);
|
||||
while(!feof(flot))
|
||||
{
|
||||
if(i == max)
|
||||
{
|
||||
printf("Le tableau est plein\n");
|
||||
return -1;
|
||||
}
|
||||
tMatieres[i] = nMatieres;
|
||||
tCoeff[i] = coeff;
|
||||
fscanf(flot, "%d%d", &nMatieres, &coeff);
|
||||
i = i + 1;
|
||||
}
|
||||
return i;
|
||||
fclose(flot);
|
||||
}
|
||||
|
||||
void affichage(int tMatieres[],int tCoeff[], int nbMatieres)
|
||||
{
|
||||
int i;
|
||||
printf("N° matieres coefficient\n");
|
||||
for(i=0; i < nbMatieres; i++)
|
||||
printf("\t%d\t%d\n", tMatieres[i], tCoeff[i]);
|
||||
}
|
||||
|
||||
int choixMenu(void)
|
||||
{
|
||||
int choix;
|
||||
printf("\t Gestion des matières\n");
|
||||
printf("1.\taffichage\n");
|
||||
printf("2.\tmodification du coefficient d'une matière\n");
|
||||
printf("3.\tcréation d'une matière\n");
|
||||
printf("4.\tsuppression d'une matière\n");
|
||||
printf("9.\tquitter\n");
|
||||
printf("\noption choisie :\n");
|
||||
scanf("%d", &choix);
|
||||
return choix;
|
||||
}
|
||||
|
||||
void gestionMatieres(void)
|
||||
{
|
||||
|
||||
int tMatieres[25] = {0}, tCoeff[25] = {0};
|
||||
int max = 25, nbMatieres, choix;
|
||||
FILE *flot;
|
||||
flot = fopen("matieres.txt", "a");
|
||||
if(flot == NULL)
|
||||
{
|
||||
printf("Pb d'ouverture du fichier matieres.txt\n");
|
||||
}
|
||||
nbMatieres = remplirTableaux(tMatieres, tCoeff, max);
|
||||
if(nbMatieres < 0)
|
||||
{
|
||||
printf("Erreur d'ouverture du fichier ou tableau plein !!!\n");
|
||||
return ;
|
||||
}
|
||||
choix = choixMenu();
|
||||
while(choix != 9)
|
||||
{
|
||||
if(choix == 1)
|
||||
{
|
||||
affichage(tMatieres, tCoeff, nbMatieres);
|
||||
}
|
||||
if(choix == 2)
|
||||
{
|
||||
modificationCoefficient(tMatieres, tCoeff, nbMatieres);
|
||||
}
|
||||
if(choix == 3)
|
||||
{
|
||||
nbMatieres = insertionNewMatiere(tMatieres, tCoeff, nbMatieres, max);
|
||||
}
|
||||
if(choix == 4)
|
||||
{
|
||||
nbMatieres = suppressionMatiere(tMatieres, tCoeff, nbMatieres);
|
||||
}
|
||||
choix = choixMenu();
|
||||
}
|
||||
sauvegarde(tMatieres, tCoeff, nbMatieres);
|
||||
fclose(flot);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int rechercherMatiere(int tMatieres[], int nbMatiere, int matiere, int *trouve)
|
||||
{
|
||||
int j;
|
||||
for(j = 0; j < nbMatiere; j++)
|
||||
{
|
||||
if(tMatieres[j] == matiere)
|
||||
{
|
||||
*trouve = 1;
|
||||
return j;
|
||||
}
|
||||
if(tMatieres[j] > matiere)
|
||||
{
|
||||
*trouve = 0;
|
||||
return j;
|
||||
}
|
||||
}
|
||||
*trouve = 0;
|
||||
return j;
|
||||
}
|
||||
|
||||
int modificationCoefficient(int tMatieres[], int tCoeff[], int nbMatieres)
|
||||
{
|
||||
int matieres, coeff, trouve, i;
|
||||
printf("Donnez le numéro de la matière à modifier :\n");
|
||||
scanf("%d", &matieres);
|
||||
i = rechercherMatiere(tMatieres, nbMatieres, matieres, &trouve);
|
||||
if(trouve == 0)
|
||||
{
|
||||
printf("La matière n'existe pas !!!\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Voici l'ancien coefficient de la matière %d : %d\n", matieres, tCoeff[i]);
|
||||
printf("Donnez le nouveau coefficient :\n");
|
||||
scanf("%d", &coeff);
|
||||
tCoeff[i] = coeff;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sauvegarde(int tMatieres[], int tCoeff[], int nbMatieres)
|
||||
{
|
||||
int i;
|
||||
FILE *flot;
|
||||
flot = fopen("matieres.txt", "w");
|
||||
if(flot == NULL)
|
||||
{
|
||||
printf("Pb d'ouverture du fichier matieres.txt\n");
|
||||
return -1;
|
||||
}
|
||||
for(i = 0; i < nbMatieres; i++)
|
||||
{
|
||||
fprintf(flot, "%d\t%d\n", tMatieres[i], tCoeff[i]);
|
||||
}
|
||||
fclose(flot);
|
||||
}
|
||||
|
||||
int insertionNewMatiere(int tMatieres[], int tCoeff[], int nbMatieres, int max)
|
||||
{
|
||||
int matieres, coeff, trouve, i, j;
|
||||
printf("Donnez le numéro de la matière à insérer et son coefficient :\n");
|
||||
scanf("%d%d", &matieres, &coeff);
|
||||
i = rechercherMatiere(tMatieres, nbMatieres, matieres, &trouve);
|
||||
if(trouve == 1)
|
||||
{
|
||||
printf("La matière existe déjà !!!\n");
|
||||
return -1;
|
||||
}
|
||||
for(j=nbMatieres; j>= i; j--)
|
||||
{
|
||||
tMatieres[j] = tMatieres[j-1];
|
||||
tCoeff[j] = tCoeff[j-1];
|
||||
}
|
||||
tMatieres[i]= matieres;
|
||||
tCoeff[i] = coeff;
|
||||
nbMatieres = nbMatieres + 1;
|
||||
return nbMatieres;
|
||||
}
|
||||
|
||||
int suppressionMatiere(int tMatieres[], int tCoeff[], int nbMatieres)
|
||||
{
|
||||
int matieres, coeff, trouve, i, j, max;
|
||||
printf("Donnez le numéro de la matière à supprimer :\n");
|
||||
scanf("%d", &matieres);
|
||||
i = rechercherMatiere(tMatieres, nbMatieres, matieres, &trouve);
|
||||
if(trouve == 0)
|
||||
{
|
||||
printf("La matière n'existe pas !!!\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Coefficient de la matière à supprimer : %d\n", tCoeff[i]);
|
||||
for(j=i; j<(nbMatieres-1); j++)
|
||||
{
|
||||
tMatieres[j] = tMatieres[j+1];
|
||||
tCoeff[j] = tCoeff[j+1];
|
||||
}
|
||||
nbMatieres = nbMatieres -1;
|
||||
return nbMatieres;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int remplirTableaux(int tMatieres[],int tCoeff[],int max);
|
||||
void affichage(int tMatieres[],int tCoeff[],int nbMatieres);
|
||||
void gestionMatieres(void);
|
||||
int rechercherMatiere(int tMatieres[], int i, int matieres, int *trouve);
|
||||
int modificationCoefficient(int tMatieres[], int tCoeff[], int nbMatieres);
|
||||
int sauvegarde(int tMatieres[], int tCoeff[], int nbMatieres);
|
||||
int insertionNewMatiere(int tMatieres[], int tCoeff[], int nbMatieres, int max);
|
||||
int suppressionMatiere(int tMatieres[], int tCoeff[], int nbMatieres);
|
@ -0,0 +1,5 @@
|
||||
18 20
|
||||
20 22
|
||||
25 27
|
||||
27 30
|
||||
45 20
|
@ -0,0 +1,6 @@
|
||||
85 18 15
|
||||
85 11 14
|
||||
101 18 13
|
||||
101 31 12.3
|
||||
101 18 11
|
||||
103 11 16
|
@ -0,0 +1,20 @@
|
||||
#include "tp7.h"
|
||||
|
||||
void testRemplir(void)
|
||||
{
|
||||
int max, res;
|
||||
int tMatieres[150] = {0}, tCoeff[150] = {0};
|
||||
printf("Donnez une valeur physique pour le tableau :");
|
||||
scanf("%d", &max);
|
||||
res = remplirTableaux(tMatieres, tCoeff, max);
|
||||
printf("res : %d\n", res);
|
||||
}
|
||||
|
||||
|
||||
int main (void)
|
||||
{
|
||||
//testRemplir();
|
||||
gestionMatieres();
|
||||
//remplirTableaux();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,270 @@
|
||||
#include "tp7.h"
|
||||
|
||||
int remplirTableaux(int tMatieres[],int tCoeff[],int max)
|
||||
{
|
||||
int nMatieres, coeff, i = 0;
|
||||
FILE *flot;
|
||||
flot = fopen("matieres.txt", "r");
|
||||
if(flot == NULL)
|
||||
{
|
||||
printf("Pb d'ouverture du fichier matieres.txt\n");
|
||||
return -1;
|
||||
}
|
||||
fscanf(flot, "%d%d", &nMatieres, &coeff);
|
||||
while(!feof(flot))
|
||||
{
|
||||
if(i == max)
|
||||
{
|
||||
printf("Le tableau est plein\n");
|
||||
return -1;
|
||||
}
|
||||
tMatieres[i] = nMatieres;
|
||||
tCoeff[i] = coeff;
|
||||
fscanf(flot, "%d%d", &nMatieres, &coeff);
|
||||
i = i + 1;
|
||||
}
|
||||
return i;
|
||||
fclose(flot);
|
||||
}
|
||||
|
||||
void affichage(int tMatieres[],int tCoeff[], int nbMatieres)
|
||||
{
|
||||
int i;
|
||||
printf("N° matieres coefficient\n");
|
||||
for(i=0; i < nbMatieres; i++)
|
||||
printf("\t%d\t%d\n", tMatieres[i], tCoeff[i]);
|
||||
}
|
||||
|
||||
|
||||
int choixMenu(void)
|
||||
{
|
||||
int choix;
|
||||
printf("\t Gestion des matières\n");
|
||||
printf("1.\taffichage\n");
|
||||
printf("2.\tmodification du coefficient d'une matière\n");
|
||||
printf("3.\tcréation d'une matière\n");
|
||||
printf("4.\tsuppression d'une matière\n");
|
||||
printf("5.\tmoyenne des notes dans chaque matières\n");
|
||||
printf("6.\tmoyenne d'un étudiant\n");
|
||||
printf("9.\tquitter\n");
|
||||
printf("\noption choisie :\n");
|
||||
scanf("%d", &choix);
|
||||
return choix;
|
||||
}
|
||||
|
||||
void gestionMatieres(void)
|
||||
{
|
||||
|
||||
int tMatieres[25] = {0}, tCoeff[25] = {0}, tNotes[25] = {0}, tNbNotes[25] = {0};
|
||||
int max = 25, nbMatieres, choix;
|
||||
FILE *flot;
|
||||
flot = fopen("matieres.txt", "a");
|
||||
if(flot == NULL)
|
||||
{
|
||||
printf("Pb d'ouverture du fichier matieres.txt\n");
|
||||
}
|
||||
nbMatieres = remplirTableaux(tMatieres, tCoeff, max);
|
||||
if(nbMatieres < 0)
|
||||
{
|
||||
printf("Erreur d'ouverture du fichier ou tableau plein !!!\n");
|
||||
return ;
|
||||
}
|
||||
choix = choixMenu();
|
||||
while(choix != 9)
|
||||
{
|
||||
if(choix == 1)
|
||||
{
|
||||
affichage(tMatieres, tCoeff, nbMatieres);
|
||||
}
|
||||
if(choix == 2)
|
||||
{
|
||||
modificationCoefficient(tMatieres, tCoeff, nbMatieres);
|
||||
}
|
||||
if(choix == 3)
|
||||
{
|
||||
nbMatieres = insertionNewMatiere(tMatieres, tCoeff, nbMatieres, max);
|
||||
}
|
||||
if(choix == 4)
|
||||
{
|
||||
nbMatieres = suppressionMatiere(tMatieres, tCoeff, nbMatieres);
|
||||
}
|
||||
if(choix == 5)
|
||||
{
|
||||
MoyenneNotesMatiere(tMatieres, tNotes, tNbNotes, nbMatieres);
|
||||
}
|
||||
if(choix == 6)
|
||||
{
|
||||
MoyenneEtudiant(tCoeff, tMatieres, tNotes, tNbNotes, nbMatieres);
|
||||
}
|
||||
choix = choixMenu();
|
||||
}
|
||||
sauvegarde(tMatieres, tCoeff, nbMatieres);
|
||||
fclose(flot);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
int rechercherMatiere(int tMatieres[], int nbMatiere, int matiere, int *trouve)
|
||||
{
|
||||
int j;
|
||||
for(j = 0; j < nbMatiere; j++)
|
||||
{
|
||||
if(tMatieres[j] == matiere)
|
||||
{
|
||||
*trouve = 1;
|
||||
return j;
|
||||
}
|
||||
if(tMatieres[j] > matiere)
|
||||
{
|
||||
*trouve = 0;
|
||||
return j;
|
||||
}
|
||||
}
|
||||
*trouve = 0;
|
||||
return j;
|
||||
}
|
||||
|
||||
int modificationCoefficient(int tMatieres[], int tCoeff[], int nbMatieres)
|
||||
{
|
||||
int matieres, coeff, trouve, i;
|
||||
printf("Donnez le numéro de la matière à modifier :\n");
|
||||
scanf("%d", &matieres);
|
||||
i = rechercherMatiere(tMatieres, nbMatieres, matieres, &trouve);
|
||||
if(trouve == 0)
|
||||
{
|
||||
printf("La matière n'existe pas !!!\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Voici l'ancien coefficient de la matière %d : %d\n", matieres, tCoeff[i]);
|
||||
printf("Donnez le nouveau coefficient :\n");
|
||||
scanf("%d", &coeff);
|
||||
tCoeff[i] = coeff;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sauvegarde(int tMatieres[], int tCoeff[], int nbMatieres)
|
||||
{
|
||||
int i;
|
||||
FILE *flot;
|
||||
flot = fopen("matieres.txt", "w");
|
||||
if(flot == NULL)
|
||||
{
|
||||
printf("Pb d'ouverture du fichier matieres.txt\n");
|
||||
return -1;
|
||||
}
|
||||
for(i = 0; i < nbMatieres; i++)
|
||||
{
|
||||
fprintf(flot, "%d\t%d\n", tMatieres[i], tCoeff[i]);
|
||||
}
|
||||
fclose(flot);
|
||||
}
|
||||
|
||||
int insertionNewMatiere(int tMatieres[], int tCoeff[], int nbMatieres, int max)
|
||||
{
|
||||
int matieres, coeff, trouve, i, j;
|
||||
printf("Donnez le numéro de la matière à insérer et son coefficient :\n");
|
||||
scanf("%d%d", &matieres, &coeff);
|
||||
i = rechercherMatiere(tMatieres, nbMatieres, matieres, &trouve);
|
||||
if(trouve == 1)
|
||||
{
|
||||
printf("La matière existe déjà !!!\n");
|
||||
return -1;
|
||||
}
|
||||
for(j=nbMatieres; j>= i; j--)
|
||||
{
|
||||
tMatieres[j] = tMatieres[j-1];
|
||||
tCoeff[j] = tCoeff[j-1];
|
||||
}
|
||||
tMatieres[i]= matieres;
|
||||
tCoeff[i] = coeff;
|
||||
nbMatieres = nbMatieres + 1;
|
||||
return nbMatieres;
|
||||
}
|
||||
|
||||
int suppressionMatiere(int tMatieres[], int tCoeff[], int nbMatieres)
|
||||
{
|
||||
int matieres, coeff, trouve, i, j, max;
|
||||
printf("Donnez le numéro de la matière à supprimer :\n");
|
||||
scanf("%d", &matieres);
|
||||
i = rechercherMatiere(tMatieres, nbMatieres, matieres, &trouve);
|
||||
if(trouve == 0)
|
||||
{
|
||||
printf("La matière n'existe pas !!!\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Coefficient de la matière à supprimer : %d\n", tCoeff[i]);
|
||||
for(j=i; j<(nbMatieres-1); j++)
|
||||
{
|
||||
tMatieres[j] = tMatieres[j+1];
|
||||
tCoeff[j] = tCoeff[j+1];
|
||||
}
|
||||
nbMatieres = nbMatieres -1;
|
||||
return nbMatieres;
|
||||
}
|
||||
|
||||
int MoyenneNotesMatiere(int tMatieres[], int tNotes[], int tNbNotes[], int nbMatieres)
|
||||
{
|
||||
int nbNotes, somme, Etudiant, i, matiere, note, trouve, moyenne;
|
||||
FILE *flot;
|
||||
flot = fopen("matieres2.txt", "r");
|
||||
if(flot == NULL)
|
||||
{
|
||||
printf("Pb d'ouverture du fichier matieres2.txt\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Donnez le numéro de la matière pour laquelle vous voulez calculer la moyenne :\n");
|
||||
scanf("%d", &matiere);
|
||||
i = rechercherMatiere(tMatieres, nbMatieres, matiere, &trouve);
|
||||
if(trouve == 0)
|
||||
{
|
||||
printf("La matière n'existe pas !!!\n");
|
||||
return -1;
|
||||
}
|
||||
while(!feof(flot))
|
||||
{
|
||||
fscanf(flot, "%d%d%d", &Etudiant, &matiere, ¬e);
|
||||
if(matiere == tMatieres[i])
|
||||
{
|
||||
tNotes[i] = tNotes[i] + note;
|
||||
tNbNotes[i] = tNbNotes[i] + 1;
|
||||
}
|
||||
}
|
||||
somme = tNotes[i];
|
||||
nbNotes = tNbNotes[i];
|
||||
moyenne = Moyenne(somme, nbNotes);
|
||||
tNotes[i] = moyenne;
|
||||
printf("N°Matière\tMoyenne\n");
|
||||
for(i = 0; i < nbMatieres; i++)
|
||||
{
|
||||
if(tNbNotes[i] != 0)
|
||||
printf("\t%d\t%d\n", tMatieres[i], tNotes[i]);
|
||||
else printf("\t%d\tpas de note\n", tMatieres[i]);
|
||||
}
|
||||
}
|
||||
|
||||
float Moyenne(int somme, int nbNotes)
|
||||
{
|
||||
float moyenne;
|
||||
moyenne = (float)somme / nbNotes;
|
||||
return moyenne;
|
||||
}
|
||||
|
||||
void MoyenneEtudiant(int tCoeff[], int tMatieres[], int tNotes[], int tNbNotes[], int nbMatieres)
|
||||
{
|
||||
int i, cumulNotes, cumulcoeff, moyenne, moyenneMatiere;
|
||||
cumulNotes = 0;
|
||||
for(i = 0; i < nbMatieres; i++)
|
||||
{
|
||||
cumulNotes = cumulNotes + tNotes[i] * tCoeff[i];
|
||||
cumulcoeff = cumulcoeff + tCoeff[i];
|
||||
}
|
||||
moyenneMatiere = cumulNotes / cumulcoeff;
|
||||
printf("N°Matière\tMoyenne\n");
|
||||
for(i = 0; i < nbMatieres; i++)
|
||||
{
|
||||
if(tNbNotes[i] != 0)
|
||||
printf("\t%d\t%d\n", tMatieres[i], tNotes[i]);
|
||||
else printf("\t%d\tpas de note\n", tMatieres[i]);
|
||||
}
|
||||
printf("Moyenne générale\t%d\n", moyenneMatiere);
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int remplirTableaux(int tMatieres[],int tCoeff[],int max);
|
||||
void affichage(int tMatieres[],int tCoeff[],int nbMatieres);
|
||||
void gestionMatieres(void);
|
||||
int rechercherMatiere(int tMatieres[], int i, int matieres, int *trouve);
|
||||
int modificationCoefficient(int tMatieres[], int tCoeff[], int nbMatieres);
|
||||
int sauvegarde(int tMatieres[], int tCoeff[], int nbMatieres);
|
||||
int insertionNewMatiere(int tMatieres[], int tCoeff[], int nbMatieres, int max);
|
||||
int suppressionMatiere(int tMatieres[], int tCoeff[], int nbMatieres);
|
||||
int MoyenneNotesMatiere(int tMatieres[], int tNotes[], int tNbNotes[], int nbMatieres);
|
||||
float Moyenne(int somme, int nbNotes);
|
||||
void MoyenneEtudiant(int tCoeff[], int tMatieres[], int tNotes[], int tNbNotes[], int nbMatieres);
|