Skip to the task
Layout
Back to classic view

You are looking at lesson 1. Your place is still lesson 6, task 1: Arrays.

RUNTask 11 of 21 · step 5: Special charactersRun it and look at the columns
Run it and look at the columns in practice/01/

Run p01_hello. The table's second column should start at the same place on all three lines.

Checklist

  • Every task is one commit with a clear message.

Numbered notes in the code explain the important lines.

Details & hint
$ .\build\debug\practice\01\p01_hello.exe
Hello, world!

Algorithm: the average of grades
1. Add up all the grades.
2. Count how many grades there are.
3. Divide the sum by the count.
4. Print the answer.

Grade	Meaning
10	"excellent"
5	"satisfactory"
File: C:\course\practice\01\main.c
Done: 100%

You should see: Grade and 10 are both shorter than 8 characters, so \t takes them to the same column. One \ in the path, 100% at the end.

practice 01 main.c Code Diff +6
M · MODIFIED Green = add, blue = change, red mark = removed line.
#include <stdio.h>
int main(void) {
printf("Hello, world!\n");
printf("\n");
printf("Algorithm: the average of grades\n");
printf("1. Add up all the grades.\n");
printf("2. Count how many grades there are.\n");
printf("3. Divide the sum by the count.\n");
printf("4. Print the answer.\n");
printf("\n");
printf("Grade\tMeaning\n");
Note 1: \t is a tab: a jump to the next column.
printf("10\t\"excellent\"\n");
Note 2: \" is a quote inside the string.
printf("5\t\"satisfactory\"\n");
printf("File: C:\\course\\practice\\01\\main.c\n");
Note 3: \\ is one \ in the path.
printf("Done: 100%%\n");
Note 4: %% is one % in a printf string.
return 0;
}
opened for this task
$ .\build\debug\practice\01\p01_hello.exe
Hello, world!

Algorithm: the average of grades
1. Add up all the grades.
2. Count how many grades there are.
3. Divide the sum by the count.
4. Print the answer.

Grade	Meaning
10	"excellent"
5	"satisfactory"
File: C:\course\practice\01\main.c
Done: 100%