Thursday, May 28, 2020
Monday, May 18, 2020
format your code better? In a way that's more readable? the way it looks in an IDE ( copied code form web )
There are multiple solutions
- If you have IDE you can copy paste code and can just call format code ( in eclipse short cut is CTRL + SHIFT + F , In Clion or similar ide CTRL + ALT + L, you get the idea )
- Other way is to use something called codebutifier.
- ex. https://codebeautify.org/cpp-formatter-beautifier
- copy your code and Click Format
code template in blogger
When you copy the code to the blogger it gets truncated due to HTML.
The simple solution is to write your code github by clicking the link. ( you may need to create an account if you don't have one, this may change in future)
1. https://gist.github.com/
2. Write the file name ( extension is important ex. test.cpp)
3. Copy your code as shown
4. push the "Create public gist"
5. now copy the Embed link and paste in your blog.
6. publish the post and it looks something like bellow.
The simple solution is to write your code github by clicking the link. ( you may need to create an account if you don't have one, this may change in future)
1. https://gist.github.com/
2. Write the file name ( extension is important ex. test.cpp)
3. Copy your code as shown
5. now copy the Embed link and paste in your blog.
6. publish the post and it looks something like bellow.
error: ‘std::vector’ is not a type
int singleNumber( std::vector& nums )
solution:
you have to declare the type.
most of the c++ code that gets copied to html gets truncated and thus this happens. Following can help
https://mihirknows.blogspot.com/2020/05/code-template-in-blogger.html
Subscribe to:
Posts (Atom)