Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
enonce
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
programmation_sequentielle
travaux_pratiques
c_lang
shortest_path
enonce
Commits
39aa1278
Commit
39aa1278
authored
4 years ago
by
orestis.malaspin
Browse files
Options
Downloads
Patches
Plain Diff
updated main.c
parent
c438012a
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#11973
passed
4 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
squelette/c/main.c
+12
-12
12 additions, 12 deletions
squelette/c/main.c
with
12 additions
and
12 deletions
squelette/c/main.c
+
12
−
12
View file @
39aa1278
...
@@ -11,8 +11,9 @@ int main(int argc, char** argv) {
...
@@ -11,8 +11,9 @@ int main(int argc, char** argv) {
char
*
line
=
NULL
;
char
*
line
=
NULL
;
char
*
str1
=
NULL
;
char
*
str1
=
NULL
;
char
*
str2
=
NULL
;
char
*
str2
=
NULL
;
char
*
str3
=
NULL
;;
size_t
len
=
0
;
size_t
len
=
0
;
size_t
len1
=
0
;
size_t
len2
=
0
;
FILE
*
input
=
stdin
;
FILE
*
input
=
stdin
;
if
(
argc
>
1
)
input
=
fopen
(
argv
[
1
],
"r
\n
"
);
if
(
argc
>
1
)
input
=
fopen
(
argv
[
1
],
"r
\n
"
);
...
@@ -126,39 +127,39 @@ int main(int argc, char** argv) {
...
@@ -126,39 +127,39 @@ int main(int argc, char** argv) {
break
;
break
;
case
6
:
case
6
:
fprintf
(
stderr
,
"Ville d'origine:
\n
"
);
fprintf
(
stderr
,
"Ville d'origine:
\n
"
);
getline
(
&
str1
,
&
len
,
input
);
getline
(
&
str1
,
&
len
1
,
input
);
fprintf
(
stderr
,
"Ville de destination:
\n
"
);
fprintf
(
stderr
,
"Ville de destination:
\n
"
);
getline
(
&
str2
,
&
len
,
input
);
getline
(
&
str2
,
&
len
2
,
input
);
fprintf
(
stderr
,
"Distance: "
);
fprintf
(
stderr
,
"Distance: "
);
// format de sortie -> à générer avec votre code
// format de sortie -> à générer avec votre code
printf
(
"%i
\n
"
,
123
);
// valeur pour Geneve à Delemont
printf
(
"%i
\n
"
,
123
);
// valeur pour Geneve à Delemont
break
;
break
;
case
7
:
case
7
:
fprintf
(
stderr
,
"Ville d'origine:
\n
"
);
fprintf
(
stderr
,
"Ville d'origine:
\n
"
);
getline
(
&
str1
,
&
len
,
input
);
getline
(
&
str1
,
&
len
1
,
input
);
fprintf
(
stderr
,
"Ville de destination:
\n
"
);
fprintf
(
stderr
,
"Ville de destination:
\n
"
);
getline
(
&
str2
,
&
len
,
input
);
getline
(
&
str2
,
&
len
2
,
input
);
fprintf
(
stderr
,
"Parcours: "
);
fprintf
(
stderr
,
"Parcours: "
);
// format de sortie -> à générer avec votre code
// format de sortie -> à générer avec votre code
printf
(
"[Geneve:Lausanne:Berne:Zurich:Coire]
\n
"
);
// résultat pour Geneve à Coire
printf
(
"[Geneve:Lausanne:Berne:Zurich:Coire]
\n
"
);
// résultat pour Geneve à Coire
break
;
break
;
case
8
:
case
8
:
fprintf
(
stderr
,
"Ville d'origine:
\n
"
);
fprintf
(
stderr
,
"Ville d'origine:
\n
"
);
getline
(
&
str1
,
&
len
,
input
);
getline
(
&
str1
,
&
len
1
,
input
);
// format de sortie -> à générer avec votre code
// format de sortie -> à générer avec votre code
printf
(
"[Geneve:0] [Lausanne:34] [Neuchatel:74] [Delemont:123] [Bale:157] [Berne:101] $[Lucerne:184] [Zurich:180] [Schaffouse:222] [St.-Gall:246] [Coire:271] [St.-Moritz:387] [Bellinzone:316] [Andermatt:263] [Sion:101]
\n
"
);
// résultat pour Geneve
printf
(
"[Geneve:0] [Lausanne:34] [Neuchatel:74] [Delemont:123] [Bale:157] [Berne:101] $[Lucerne:184] [Zurich:180] [Schaffouse:222] [St.-Gall:246] [Coire:271] [St.-Moritz:387] [Bellinzone:316] [Andermatt:263] [Sion:101]
\n
"
);
// résultat pour Geneve
break
;
break
;
case
9
:
case
9
:
fprintf
(
stderr
,
"Ville d'origine:
\n
"
);
fprintf
(
stderr
,
"Ville d'origine:
\n
"
);
getline
(
&
str1
,
&
len
,
input
);
getline
(
&
str1
,
&
len
1
,
input
);
// format de sortie -> à générer avec votre code
// format de sortie -> à générer avec votre code
printf
(
"[Geneve<-Lausanne] [Lausanne<-Neuchatel] [Neuchatel<-Delemont] [Delemont<-Bale] [Lausanne<-Berne] [Berne<-Lucerne] [Berne<-Zurich] [Zurich<-Schaffouse] [Zurich<-St.-Gall] [Zurich<-Coire] [Coire<-St.-Moritz] [Lucerne<-Bellinzone] [Sion<-Andermatt] [Lausanne<-Sion]
\n
"
);
// résultat pour Geneve
printf
(
"[Geneve<-Lausanne] [Lausanne<-Neuchatel] [Neuchatel<-Delemont] [Delemont<-Bale] [Lausanne<-Berne] [Berne<-Lucerne] [Berne<-Zurich] [Zurich<-Schaffouse] [Zurich<-St.-Gall] [Zurich<-Coire] [Coire<-St.-Moritz] [Lucerne<-Bellinzone] [Sion<-Andermatt] [Lausanne<-Sion]
\n
"
);
// résultat pour Geneve
break
;
break
;
case
10
:
case
10
:
fprintf
(
stderr
,
"Ville d'origine:
\n
"
);
fprintf
(
stderr
,
"Ville d'origine:
\n
"
);
getline
(
&
str1
,
&
len
,
input
);
getline
(
&
str1
,
&
len
1
,
input
);
fprintf
(
stderr
,
"Ville de destination:
\n
"
);
fprintf
(
stderr
,
"Ville de destination:
\n
"
);
getline
(
&
str2
,
&
len
,
input
);
getline
(
&
str2
,
&
len
2
,
input
);
fprintf
(
stderr
,
"Distance: "
);
fprintf
(
stderr
,
"Distance: "
);
// format de sortie -> à générer avec votre code
// format de sortie -> à générer avec votre code
// imprimer "inf" à la place INT_MAX
// imprimer "inf" à la place INT_MAX
...
@@ -166,9 +167,9 @@ int main(int argc, char** argv) {
...
@@ -166,9 +167,9 @@ int main(int argc, char** argv) {
break
;
break
;
case
11
:
case
11
:
fprintf
(
stderr
,
"Ville d'origine:
\n
"
);
fprintf
(
stderr
,
"Ville d'origine:
\n
"
);
getline
(
&
str1
,
&
len
,
input
);
getline
(
&
str1
,
&
len
1
,
input
);
fprintf
(
stderr
,
"Ville de destination:
\n
"
);
fprintf
(
stderr
,
"Ville de destination:
\n
"
);
getline
(
&
str2
,
&
len
,
input
);
getline
(
&
str2
,
&
len
2
,
input
);
fprintf
(
stderr
,
"Parcours: "
);
fprintf
(
stderr
,
"Parcours: "
);
// format de sortie -> à générer avec votre code
// format de sortie -> à générer avec votre code
printf
(
"[Bale:Zurich:Coire:St.-Moritz]
\n
"
);
// résultat pour Bale à St.-Moritz
printf
(
"[Bale:Zurich:Coire:St.-Moritz]
\n
"
);
// résultat pour Bale à St.-Moritz
...
@@ -179,7 +180,6 @@ int main(int argc, char** argv) {
...
@@ -179,7 +180,6 @@ int main(int argc, char** argv) {
free
(
line
);
free
(
line
);
free
(
str1
);
free
(
str1
);
free
(
str2
);
free
(
str2
);
free
(
str3
);
fclose
(
input
);
fclose
(
input
);
return
0
;
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment