Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
viakul
/
iax0583
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
fc215fc3
authored
Dec 04, 2018
by
viakul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Homework_2.c
parent
433089c7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
Homework 2/Homework_2.c
Homework 2/Homework_2.c
View file @
fc215fc3
...
@@ -171,13 +171,6 @@ void tracePrint(char arr1[15][20], int n){
...
@@ -171,13 +171,6 @@ void tracePrint(char arr1[15][20], int n){
/*function input:
* empty arrays of distances and names of traces,
* values for distances, number of traces;
* Since it is requred to know n traces and n distances
* the code reads the user input 2n times
*/
void
filling_array
(
char
arr
[
15
][
20
],
char
arr1
[
15
][
20
],
float
val
[
15
],
int
n
){
void
filling_array
(
char
arr
[
15
][
20
],
char
arr1
[
15
][
20
],
float
val
[
15
],
int
n
){
int
i
,
y
,
j
;
int
i
,
y
,
j
;
//use the variable to keep track of different elements inside arrays
//use the variable to keep track of different elements inside arrays
...
@@ -198,12 +191,24 @@ void tracePrint(char arr1[15][20], int n){
...
@@ -198,12 +191,24 @@ void tracePrint(char arr1[15][20], int n){
else
else
{
{
printf
(
"Write the distance #%d:
\n
"
,
y
+
1
);
printf
(
"Write the distance #%d:
\n
"
,
y
+
1
);
scanf
(
"%s"
,
arr1
[
y
]);
while
(
1
)
val
[
y
]
=
atof
(
arr1
[
y
]);
{
scanf
(
"%s"
,
arr1
[
y
]);
val
[
y
]
=
atof
(
arr1
[
y
]);
//atof converts the string to a float
//atof converts the string to a float
if
(
val
[
y
]
>
0
)
{
y
++
;
y
++
;
break
;
}
else
{
printf
(
"Please write the valid expression for the length it should be positive
\n
"
);
}
}
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment