Let’s have fun with… numbers??

--Originally published at Loading…

This is what Ken asked us to do:

Ask the user for two integer values, then use those two values to calculate and show the following:

  • The sum of the two numbers.
  • The difference of the two numbers.
  • The product of the two numbers.
  • The integer based division of the two numbers (so no decimal point). First divided by second.
  • The remainder of integer division of the two numbers.

So the first thing that I did was to declare all my variables as an integer with “int”. n01 and n02 are for the numbers to print on the terminal. Then the other 5 variables are for each one of the results of the operations that the program had to realize.  Later I put the instruction of cout to show the message “Enter the number” (and all the others messages) and cin in order that the user could give the value to the variable with the number that he wishes. Finally to give a value to n03 (or the others 4 variables) I wrote the formula for each operation, and print the result on the screen.

This is my code:

hwphoto3hwphoto4

It was nice to remember the basic things!! 


Hot Programming

--Originally published at Programming 101

Hello guys! This is my third post, as well as my third assignment. I found this assignment fun and super easy.

Basically what we had to do was to write a program that would show a temperature in Fahrenheit coverted to Celsius. In addition we had to write weather water would boil or not in the given temperature.

While I was writing my program I had little doubts. One was the correct structure for the conditional ‘if’. I did a little research and found out that I had to use these guys ‘{ }’ at the beginning and at the end of the conditional. Here’s the link I used to clarify my doubts, hopefully it can help you as well: https://www.programiz.com/c-programming/c-if-else-statement

After that I finished my program and when I ran it, I had a couple mistakes because I had forgotten to write at the end of two sentences the super famous ‘;’ semicolon. But no bigger errors appeared.

I really liked this activity and I hope y’all are doing great.

I’ll leave here my run program with the three possible outcomes and the structure I used in Atom.

Good luck guys, cheers!

captura-de-pantalla-8


Post of the week #2 what things i learned in this week #2 ?

--Originally published at Solving Problems with Programming

Picture of the author.

First let me tell you that in my last week post i learn all transversal topics that are:

  • Ability to create C++ file and run from command line (terminal)
  • Create accounts: Blog, Twitter, GitHub
  • Submit work via Blog RSS and GitHub
  • Demonstrate use of Linux sufficient for quizzes/exams
  • Install Linux on their own computer

And I explained it in my post: Post of the week #1 what things i learned in this week #1 ?

I also explain my project and formed a small team that corresponds of completing this ability to create C++ project in IDE and run inside the IDE and can be explained in my post My Project For the Course TC1017 and Expo Ing

In this week i learned more mastery topics besides of the mastery ones i learnt from last week. I learned these mastery topics:

#Mastery01 #Masterytopic01 #MasteryTopic01 #MASTERY01 #MASTERYTOPIC01 that i talked in my blog: #WSQ01 Post Fun with Numbers 16/01/17 and WSQ1.cpp

In this week i learned the #Mastery02 #Masterytopic02 #MasteryTopic02 #MASTERY02 #MASTERYTOPIC02 that is C++ Good Style coding conventions. I achieve this mastery arranging the spaces between the sentences of my code and also by doing plugins for my c++ codes after my teacher give me this feedback:

ken.png

With this link Code »Posting Source Code i used this part of code to use while posting my c++ code in a better way on my last post #WSQ01 Post Fun with Numbers 16/01/17 and WSQ1.cpp . The code i used for it is this:

plugin2

Link of image: Code »Posting Source Code

While you are going to publish your code on C++ in the wordpress editing page you need to copy paste this short code and change the extension of the code, instead of “css” will be the

plugin3
c3
Continue reading "Post of the week #2 what things i learned in this week #2 ?"

Programming + Maths

--Originally published at Programming 101

Hello again everybody! So, my second programming challenge was not hard and I was pretty surprised about it. Basically, I had to create a program that could add, multiply and divide two integer numbers and present the results. At first I was a bit nervous but after reading a little about the math operations in C++ I got confident and typed my code right away.

I certainly like the course this class is taking and I am looking forward to the new challenges Ken has for us.

So, here is the screenshot of my code and the run program… I think it looks pretty :b

Thanks for reading, cheers!

captura-de-pantalla-3


Codes

--Originally published at Tec Life

Here I is what I do with the first 5 programs that Ken´s give us.

Here are the problems:

  • The sum of the two numbers.
  • The difference of the two numbers.
  • The product of the two numbers.
  • The integer based division of the two numbers (so no decimal point). First divided by second.
  • The remainder of integer division of the two numbers.

In order to solve this programs I search on the internet what operations or what commands I was needed to us to solve them, so I found this page: http://www.cplusplus.com/reference/iostream/

Were it says all the thing and commands that I can use with the library <iostream>, so I start coding.

The first thing that I did was declare my variables as integers “int” followed by a coma every single variable, and in all the cases I only use 3 variables “n1, n2, n3”, n1 as the first number to print on the terminal, n2 as the second number to print, and n3 as the result of the operation. So I start texting my first order that was to print the first number that I give him so I put with a “cout” the order and with “cin” to input the number. And finally to give a value to n3 I put “n3 = n1 (the operation I wanted to made +, -, *, /, %) n2”, and print the result on the screen.

Here are my programs:

Sum:

captura-de-pantalla-2017-01-16-a-las-09-05-12

Difference:

captura-de-pantalla-2017-01-16-a-las-09-07-26

Product:

captura-de-pantalla-2017-01-16-a-las-09-11-32

Division:

captura-de-pantalla-2017-01-16-a-las-09-14-59

Residue:

captura-de-pantalla-2017-01-16-a-las-09-17-54

And 1 in all:

captura-de-pantalla-2017-01-16-a-las-09-28-24


Where were we?

--Originally published at prgrm.co

Fun with numbers A.K.A WSQ 01.

Something I didn’t mention in the post before this one, is how the “self-grading” works. For what I understand we need to cover a variety of mastery topics. I’ll go nuts and try tackling as much of them as I can in this post.

Mastery Topic 1: Use of comments.

Well isn’t this one real easy? There are two ways of commenting in c++:

  1. Single-line comments: add // before each line.
  2. Multi-line comments: /* your interesting text here */

Why comment? Well, when doing more complex programs, a comment is always a helpful reminder of what’s doing what.

Mastery Topic 2: C++ Good Style coding conventions

So everyone has a different way to understand and process things, so there is no “actual” way to code, but there are a couple of guidelines that I think is important to follow.

  1. Name your variables in a way that make sense
  2. Watch out for those brackets, you don’t want to loose them or get them mixed up, use your TAB key wisely.

You’ll see what I’m talking about in the code below.

Mastery Topic 3: Basic types and uses

There are different types of variables:captura-de-pantalla-2017-01-24-a-las-12-20-02-p-m

Link for the picture.

Mastery Topic 4: Basic Output.

This one is an easy one as well, you will need this for almost all your programs

  1. Write this at the beginning of your code #include <iostream>, this includes the library in which cout is.
  2. Write this as well include namespace std; this will save you time during your whole project.
  3. Then simply write: cout << ” Your interesting text here “.

Mastery Topic 5: Basic Input.

This is really important but easy as well, it is important because that’s how you’ll ask the user to insert data.

  1. You need to be able to declare your variables prior to
    captura-de-pantalla-2017-01-24-a-las-12-27-20-p-m
    captura-de-pantalla-2017-01-24-a-las-12-31-21-p-m
    Continue reading "Where were we?"