mandag den 14. oktober 2019
C++ For Total Beginners - Hello World !
søndag den 21. juli 2019
PHP - The Continue Statement
Eaxample exercise 4-36. Trapping division-by-zero erros using continue.
søndag den 14. juli 2019
C++ exercise 1.9 - C++ Primer 4th edition 2005
ISBN-13: 978-0-201-72148-5
ISBN:10: 0-201-72148-1
Page 17.
Exercise Section 1.4.2
Exercise 1.9: What does the following for loop do? What is the final value of sum?
int sum = 0; for(int i = -100; i <= 100; ++i) sum += i;
mandag den 27. maj 2019
C++ a beginner understand
When writing a simple HelloWorld program it's is a step towards a higher call. A world of imagination an complicated creativity 😛
#include <iostream>
int main()
{
std::count << "Hello, World!" << std::endl;
}
I understand now that this small program could also have been written in a not so readable way
#include <iostream> int main(){std::count<<"Hello, World!"<< std::endl;}
It is not very readable for a human being to quickly make sense of the program
In a human readable program you have spaces, indentations, line shift and one of the most fundamental of programming is giving your code a visual structure and it doesn't matter which programming language your writing because you have to consider that at some point someone will read your code, copy your code, debug your code, and if you write "obviousVariableNames" you can save a lot of commenting 😆
I still feel like a beginner who is trying understand some of the most basic things like loops, variables, if/else statements, switch, function, objects, opp.. and classes what the hell is that?
Yes.. I'm still learning and will never stop learning. It's a struggle, a hard learning student who keeps on struggling until he meets gratification and satisfaction of a programming language.
With great powers comes great responsibility.. what a geek but he got a point.
C++ using while loop to sum the numbers from 50 to 100
Exercise 1.10: Write a program that uses for loop to sum the numbers from 50 to 100. Now rewrite the program using a while loop.
In this part we rewrite the for loop to using a while loop
søndag den 26. maj 2019
C++ using for loop to sum the numbers from 50 to 100
Exercise 1.10: Write a program that uses for loop to sum the numbers from 50 to 100. Now rewrite the program using a while loop.
💥 Beware: This is not just a simple program that adds two numbers together. It is a little bit more complicated than that.
lørdag den 25. maj 2019
C++ using while loop to countdown from 10 to 0
Solution for the book C++ Primer 4th edition 2005. Page 17. Exercise 1.11
Hello and welcome to this blog post today we are going to make a solution for the exercise 1.11 on page 17 in C++ primer fourth edition book from 2005.Exercise 1.11:
Write a program using while loop to print the numbers from 10 to down to 0.
Now rewrite the program using for loop.
While loop - Solution
#include <iostream>
int main() { int i = 11; int counter = 0; while (i > counter) { i--; std::cout << i << std::endl; } return 0; }
For loop - Solution
#include <iostream> int main() { int counter = 0; for (int i = 10; i >= counter; i--) { std::cout << i << std::endl; } return 0; }