Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

viakul / iax0583

  • This project
    • Loading...
  • Sign in
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 6 years ago by viakul's avatar viakul
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

Update Homework_2.c

parent 433089c7 master
Hide whitespace changes
Inline Side-by-side
Showing with 18 additions and 13 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){
/*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){
int i, y, j;
//use the variable to keep track of different elements inside arrays
......@@ -198,12 +191,24 @@ void tracePrint(char arr1[15][20], int n){
else
{
printf("Write the distance #%d:\n", y + 1);
scanf("%s", arr1[y]);
val[y] = atof(arr1[y]);
//atof converts the string to a float
y++;
}
}
while(1)
{
scanf("%s",arr1[y]);
val[y]=atof(arr1[y]);
//atof converts the string to a float
if(val[y]>0)
{
y++;
break;
}
else
{
printf("Please write the valid expression for the length it should be positive\n");
}
}
}
}
}
......
This diff is collapsed. Click to expand it.
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment