Counting repetitions of a selected character in a sentence

--Originally published at GTO

This program ask the user two inputs, a character stored as char variable and a sentence stored in a string variable and then counts how many times does the entered character appears in the sentence, i made this with a function that evaluates the characters in the string variable and store in the count variable the times that the entered character is equal to a character in the sentence.

I haved some problems entering the character but then i found that asking for the character first and then the sentence I avoid that.

This is my program working:

Screen Shot 2017-10-14 at 7.40.29 PM.png

You can find the code here:

https://github.com/getorres99/TC1017-Fall-IMT-GTO/blob/master/Character%20counting.cpp

#programmingwithken#quiz10


Average, sum and standard deviation of numbers from lists – C++

--Originally published at GTO

This program calculates the sum, average and standard deviation of numbers using arrays.

This task had a new level of difficulty, I did not know about the use of lists so I had to investigate this subject in depth but once I understood it was much easier to develop the program. Arrays and vectors, the tow different types of lists I learned about, are very useful when it’s necessary to make operation with many different numbers.

This is a photo of a part of my code (the part where I made the functions):

Screen Shot 2017-10-10 at 7.36.04 PM

And here is my code:

https://github.com/getorres99/TC1017-Fall-IMT-GTO/blob/master/Lists%2C%20Average%2C%20Sum%20and%20Standard%20Deviation

I needed to look up for information about the use of arrays and  standard deviation, i got some information from this sources:

“How to Think Like a Computer Scientist, C++ Version”, Downey, Allen B. 2012.

https://www.programiz.com/cpp-programming/examples/standard-deviation

Also this video from Lynda.com was very useful:

https://www.lynda.com/C-tutorials/Arrays-strings/182674/366532-4.html?autoplay=true

#WSQ07#lists#teclife

 


Factorial in C++

--Originally published at GTO

For this week I made a factorial calculator, in the screenshot you can see two different ways for calculate the factorial of a number, i learned this with teacher Ken who explained me how to “convert” the mathematical definitions of factorial to code, understanding the process was easier that way so I recommend you to check what does factorial stand for mathematically so you can understand the code better.

Screen Shot 2017-09-14 at 6.37.24 PM.png

You can access my code here: https://github.com/getorres99/TC1017-Fall-IMT-GTO/blob/master/factorial.cpp

#teclife#WSQ06


Functions in C++

--Originally published at GTO

This program is a new version of “Fun with Numbers”  which was our second program but the difference was that this time I did basically the same program but making my mathematical operations apart using functions, this wasn’t very difficult because it make sense to me to do this when I need to do a more complex thing many times.

I needed to look up for information about functions in the book: “How to Think Like a Computer Scientist, C++ Version”, Downey, Allen B. 2012.

Screen Shot 2017-09-01 at 10.33.23 AM

 

You can find the full code here: https://github.com/getorres99/TC1017-Fall-IMT-GTO/blob/master/functions.cpp

#WSQ05


Sum of Numbers

--Originally published at GTO

This program ask the user two integer numbers and prints the sum of all the integer numbers between them. I didn’t  know how to make this but I found a formula for this in this page: http://www.cplusplus.com/forum/beginner/53957/

Screen Shot 2017-08-30 at 12.05.15 PM

You can find my code here: https://github.com/getorres99/TC1017-Fall-IMT-GTO/blob/master/sumofnumbers.cpp

#WSQ04#tec#programming

 


Guess the number with C++

--Originally published at GTO

This program generates a random number from 1 to 100 and then ask the user to input numbers until guessing which is the random number. To making this easier the program show hints each attempt, telling if the number is higher or lower than the input value.

The most difficult part of this program was the generation of the random number because at the beginning I was using another method and the number was repeated every time I run the program so I looked for a different way and I found the one you can see in my code in this blog: http://blog.martincruz.me/2012/09/obtener-numeros-aleatorios-en-c-rand.html

Screen Shot 2017-08-23 at 1.32.25 PM

Here is the code: https://github.com/getorres99/TC1017-Fall-IMT-GTO/blob/master/guess%20number.cpp

 

#teclife#WSQ03


Converting Temperatures in C++

--Originally published at GTO

This week the task was to make a program to convert a temperature given in Fahrenheit to Celsius and also add a line that says if water boils will boil a that temperature or not. Programming wasn’t so hard this because of the knowledge I acquired with the last tasks and my logic.

Screen Shot 2017-08-21 at 3.48.45 PM

Here is the code: https://github.com/getorres99/TC1017-Fall-IMT-GTO/blob/WEEK-3/temp.cpp#L3

#teclife#WSQ02

 


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"

Getting ready for programming WSQ-00

--Originally published at GTO

During the first week of my programming course I set up all the tools that im going to be using during the course and ideally after my course also. I have been interested in programming and learning how to make my own programs, websites, etc. I think it would not be very difficult for me to learn about this topic.

As a code editor I installed Atom which teacher Ken recommended us. And I already got Bash installed in my laptop so it seems I am ready to program, just need to start learning how-to.

-GTO

Screen Shot 2017-08-16 at 8.57.45 AM

#teclife#WSQ00