Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+17 votes
asked in CSC211_Winter2018 by (8 points)

1 Answer

+7 votes

If I'm understanding the questions correctly, you are asking how many spaces we should shift over when \t is in the code?

As a general rule, each tab shifts the cursor to after the next column that is a multiple of 8.

So if the syntax was, "Hi\tHello", the output would be,
Hi Hello
Hi(6 spaces)Hello
But if the syntax was, say, "Hello\tHi", the output would be,
Hello Hi
Hello(3 spaces)Hi

In each case, the "H" of the second word starts after the 8th column, but the spaces in between it and the word before it are different.

For simple cases like this, think of it like an equation, #ofSpaces = (8 - #ofCharactersBefore\t).

Hope this helps!

answered by (8 points)