reddit / emacs

Weird indentation in c++ code

panzerjagerSS · 2022-10-17 16:13
#include <iostream> int main(){ int userInput; int inputAnother; std::cout << "enter a num : "; std::cin >> userInput; std::cout << "enter another: "; std::cin >> inputAnother; std::cout << userInput << "+" << inputAnother << " is " << userInput+inputAnother << "\n"; std::cout << userInput << "-" << inputAnother << " is " << userInput-inputAnother << "\n"; return 0; } >In emacs i got this indentation in a file. When i clicking tab it was directly going 15 space forward after std::cout << "enter another: ";. The situation persist in just one file. Any idea what did this happen?
armour_de · 2022-10-17 18:36
C++ is white space insensitive, so I have ended up with similar code when copying things out of, or deleting, a nested block Or when trying to indicate that the invented lined make sure kind of unit of execution that perform a combined task. Messy but guides the eye a bit.
panzerjagerSS · 2022-10-17 18:52
I see now. I selected all text and pressed tab and now its all aligned.
holgerschurig · 2022-10-18 04:38
So ein Username wie Deiner braucht ein Downvote.
panzerjagerSS · 2022-10-19 04:31
You have to be kind against people political opinions. Not everyone is libtard as like you