100 Days Coding Challenge - Day 5/100 [Learning c++]
As a programmer, everyday I set out to fix new problems and overcome challenges in programming, today wasn't an exception... When I got up this morning, My code had bugs all over and they were practically invincible.
What did I do today
So first of all I continued my c++ classes today and I worked with methods and functions, successfully wrote a method and it worked. Yeeah it was a simple method to add two integers for a test.
Below is the c++ program;
# import <iostream>
using namespace std;
int sum(){
int total = 2+2;
return total;
}
int main(){
int x = sum();
cout << (x);
}
The method in the program is int sum()
once this method is called, it returns an integer value which can be stored and displayed for the user. The method can also be modified to accept two variables x and y from the user, any operation can now be carried out on the values.
This will make the program look like this:
# import <iostream>
using namespace std;
int sum(int x, int y){
int total = x+y;
return total;
}
int main(){
int total = sum(7,10);
cout << (total);
}
Next Up
My software started giving me issues with pulling data from the database, it just kept giving a thousand lines of error codes, partly my fault due to the fact that I didn't ask it to print the real error, I needed to understand my code more so I did the fault finding myself and at the end of the day... Problem fixed.
Had to do that because I read a quote by John Woods
Basically, I don't want someone slitting my throat because of bad code, so I'll go an extra mile to see that it doesn't happen.
What I Learnt
At the end of the day today, I learnt how to:
- Create c++ function
- Understand my code errors more by commenting different lines out to know where the fault is coming from.
Totally feel you man, C++ is a bitch of a language, but everything is around C/C++.
I am studying Qt framework, most of the crypto wallets use that framework, would be good to code some plugins for them.
100% True man, that's my main reason for going back to c++, these crypto's don't really like java and QT messed me up thanks to network issues i couldn't doenload it well... Thanks a lot man, I think we could learn and work faster as a team though.
oh I had a similar experience, but Qt Designer is only the IDE, you can build qt using the toolkit only and build it using a different editor, you only need qmake and basic modules to start.
Ohhh nice, could you give me a quick link?
Which IDE are you using? Looks like Arjuna.
That's Dev C++, I think I should take a look at Arjuna
Is a GTK IDE on Gnome desktop. (sorry I misspelled it)
http://anjuta.org/
Thanks man
Thanks for using eSteem!
Your post has been voted as a part of eSteem encouragement program. Keep up the good work! Install Android, iOS Mobile app or Windows, Mac, Linux Surfer app, if you haven't already!
Learn more: https://esteem.app
Join our discord: https://discord.gg/8eHupPq