First impression

--Originally published at TC 1017

At the beginning of this class I thought I wouldn’t learn anything, but as time goes I get each time surer about this way of teaching-learning, works.

This has been a really challenging class, because even when you think the activities will be easy, you realize it isn’t. There are always challenges, big or small ones but there always are.

I’ve been satisfied about this course in general and about what I’ve learned. I’m sure I’m doing the best I can and I’m doing well.

 


MSR

--Originally published at TC 1017

Mid semester review.

We were supposed to learn all of these topics (or more) during these weeks:

 

  • Use of comments

This was about comments in blogs, its just pretty simple. First you go to the publication and the “comments'” are in the bottom.

  • C++ Good Style coding conventions

NEVER write your whole code left wing aligned. You need to categorize everything so your code will look nice and you’ll identify the mistakes so much easier.

  • Basic types and their use

The most common ones are:

int -Integer values

long -Big numbers

string -String characters

char -Single character

double -Bigger space to save numbers

bool -Booleans

const -Constant values

  • Basic output (print)

“cout” is used to print a sentence giving instructions to the user. You will always use it this way:

cout<< “TEXT” << endl;

cout<< “TEXT” << ‘\n’ ;

You better make sure of never put “Cout” with a capital letter because it won’t work.

  • Basic user input (text based)

In this case you will always use “cin”, but FIRST, declare the variable (int, float, etc).

  • Creating functions

Here you use the specific function and write the variables you will use:

int sum (int X, int Y)
{
return (X+Y);

}

It’s like a small piece of code, so you’ll use return at the end.

Visit my post about Functions and watch my example: https://wordpress.com/post/marielvvblog.wordpress.com/137

  • Calling functions

You use the “cout” and declare the value you do want this way:

sum (X,Y)

Why? Because you’ve already created the function so you just specify which variables you’ll use and the order.

 

  • Importing and using libraries

You always have to put “#include” before any library.

<iostream> This is the principal. You can’t run your code without this library.

<cmath> Trigonometric functions .

<string> Using this one you can include

Continue reading "MSR"

WSQ05

--Originally published at TC 1017

ON TO FUNCTIONS!

At the beginning I didn’t understand what I had to do, but thanks to other classmates’ posts I got it.

It was just pretty easy to program, and so much similar to a previous one.

I learned that I had to declare the functions out of the main code. We have to use the “return” because the functions (sum, rest, dev, pro, and res) are kind of little pieces of code by itself, so they each one of them have to return a value.

Click to view slideshow.

You can go to my code at: https://drive.google.com/a/itesm.mx/file/d/0B0piRrApgTLyRExGWk1TWl9hdE0/view?usp=sharing

 

 

 


WSQ06

--Originally published at TC 1017

Factorial Calculator!

This was a really challenging code. I had to investigate new libraries, types of data.

Thanks to this WSQ I learned that “string” library is ONLY for programming in Windows because for a strange reason, Mac includes it.

By the way, string library is for a string of characters, in this case I used it to enable “yes” and “no” answers.

“double” is for a large space for numbers, “long” makes it even bigger.

Click to view slideshow.

You can see my code in:

https://drive.google.com/a/itesm.mx/file/d/0B0piRrApgTLyMkpZcXNLZm9wWjQ/view?usp=sharing