WSQ 01 – Fun with Numbers (Week 02)

--Originally published at Ernesto's Computing Works

Ahora en este programa, que fue el según que hice, programé operaciones matematicas, las 4 mas sencillas y comunes, simplemente trata de que el programa le pida al user 2 números, y cuando se los dé, el programa le de la suma, resta, división, multiplicación y el residuo, como era el segundo programa todavía no sabia bien que hacer así que busque un ejemplo en esta liga: https://www.programiz.com/cpp-programming/examples/add-numbers y si me ayudo, pero para entender algunas dudas le pregunte a mi professor.

Screenshot 2017-08-24 23.51.38

En mi este programa también se pueden apreciar 2 sencillo mastery topics, uno es numero 4 que es el print, en mi programa se aprecia al inicio, después de declarar mis variables, cuando pongo la función cout, al correrlo se desplegara la string que ponga ahí.

Y el opuesto a este es el mastery05, el de input, que su función es que el usuario escriba algo y se guarde como valor de una variable,  se representa como cin. Como se puede observar soy capaz de usar a mi antojo estas dos funciones.


WSQ01 – Fun with Numbers

--Originally published at MarizProfile

Captura de pantalla 2017-08-25 a la(s) 10.47.17

My second programming activity was also simple, but a little bit longer than the first one, because in this case I had to declare some variables (I could have not declared that quantity of variables and still my program would have run the same way, but it seemed to me that it was easier for me to read it and organize the lines in my code.) Previously had to read some pages in the Book, to understand and know how to declare some variables to make simple arithmetic operations and print in the screen the results of these.


My first C++ program , using Atom and Ubuntu bash on Windows.

--Originally published at August-December 2017 – Blogging through my thoughts

**Updated post**

Hello! curious readers. “Fun with numbers” is the first problem that Professor Ken Bauer assigned us.  The task was to create a program that complies with the points shown in the image and thereby solve the problem.

The language is simple to understand once you study a little. The book “How to think like a computer scientist” was very useful to conceive my code, in addition to several videos of youtube.

I hope you like program and really understand the whole code ?

Luis Felipe Garate Moreno.

WSQ01UBUNTU
Ubuntu bash
WSQ01ATOM
Atom code
masterytopicsHELLOWORLD
Mastery topics

 

 


WSQ 01 – Fun with Numbers (Week 02)

--Originally published at TC1017 (Python3) – Titel der Website

Hello students and friends,

 

my first Blog entry will be about: how to do mathematical calculations with Python3.

Why do I use Python3?

Well, I had a conversation with Ken. He suggested me, that all exercises for C++ can be done with Python3 as well.

 

Python is a universal, higher-lebel programming language. It is easy to read and has a tight programming style.

For example, Blocks are not structured by braces. They are structured by indentations.

 

To the Task

 

The task was, to choose 2 randome numbers and calculate the sum, difference, product, division and the modulo (the rest of a division).

 

The source code

SourceCode - FunWithNumbers.PNG

 

The result

Ergebnis - FunWithNumbers.PNG

 

How I ran into the matter

This was the first time, that i had something to do with Phython. So i watched a lot of tutorials to understand, how the language is working. I wrote the source code with Atom.

The special feature of the programm is, that all languages can be programmed with it. It is only important, with witch end the file is saved.

For Python3 the ending is .py. For C++ for example .cpp.

 

I hope you enjoy my first Blog entry

Best regards

Sercan Asker

 

 

 

 

 

 


Fun with Numbers

--Originally published at Valeria CT

The assignment for week 2 was Fun with Numbers. It consisted on developing a program in which the user could type in two numbers and the program would display the sum, difference, product, quotient, and remainder of these.

To do this, I read through the chapter of How To Think Like a Computer Scientist on Operators. When I got the basic idea, I began to write the code. As soon as I started doing this I realized that I knew that I had to create a variable for each of the numbers that the user would type, but I didn’t know how inputs worked, so I looked it up online and found a few webpages that explained it. It was pretty simple, thus I finished my code and tried running it.

On my first attempt my code would only display the first part of the program, so I thought that I hadn’t understood inputs quite well, but when I looked further into it, I saw that what I had was a syntax error: I was missing the “<<” between my string output and my operation outputs. I typed in the missing “<<” and ran the program again, this time successfully!

 

Here are the links that helped me develop the wsq01:

 

– Valeria


WSQ 01 (Fun with Numbers)

--Originally published at Programming in C++

I was already a little bit familiar with programming in c++ before this, so this first program was really easy to me. Though I had to remember a few things because I hadn’t program in like 10 months.

For this I use an app in my phone call “Learn C++”. I don’t recommend it for actually learning, it is more like a  review or practice kind of thing. For this first topic the information is in the first unit called “Basic Concepts”.

apps.2362.9007199266495758.f5c5c30a-5771-4048-b2f1-b28631500ea5

The code:

Imagen1

The code in general looks small, but I thought convenient to show the “results”.

Note: I used the line: “cout<<endl;” merely for aesthetic reasons. The purpose of this is to jump a line so the results won’t be all in the same line. 

 


A little bit of math with programming

--Originally published at GTO

This is the first program I made after setting up my software and programed “Hello World” and since that I have been reading and searching information about programming in C++ because I have never used it before, I do have a little bit of experience programming but not in C++, it has not been very difficult neither easy.

This program is very basic, teacher Ken asked us to made something that: 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 this is what I made:

Screen Shot 2017-08-16 at 9.03.13 AM

I already had an idea of how to start something in C++ thanks to “Hello World” but I needed to look up for information about the variables, the operators and how to show the results in the book: “How to Think Like a Computer Scientist, C++ Version”, Downey, Allen B. 2012.

My code is:

#include <iostream>
using namespace std;

int main ()
{
int a;
cout << “Please enter an integer value: “;
cin >> a;

int b;
cout << “Please enter another integer value: “;
cin >> b;

 

cout << ” their sum is ” << a+b << “.\n”; //The sum of the two numbers.
cout << ” their difference is ” << a-b << “.\n”; //The difference of the two numbers.
cout << ” their product is ” << a*b << “.\n”; //The product of the two numbers.
cout << ” their int division is ” << a/b << “.\n”; //The integer based division of the

Continue reading "A little bit of math with programming"