Skip to main content

Student at TC1017 with Ken Bauer

twitter.com/JuankGlez

#Mastery16

2 min read

This is the second time I do this Mastery16 in order to make  two points out of it!

I will explain you how to use an else conditional..

But first, why use an else conditional and how does it work. Well the else conditonal  is use with the if conditional which i already explained earlier. The else conditional is when the if conditional is false, lets say, if you ask the user something with if and is true  it wil return you whatever you put there, but if it isn´t true then it will not print anyting unless you have another if or somekind of cout outside the if, but is more bother to do that. 

What the else conditonal does is  to return you something if the if conditional isn´t true.

The syntax for using else is:

"else

{

}"

As you can se is pretty easy to do so sure it will be no problem using it.

But let see how will you use with an if when the variable num is somehting the user give us and we ask for a number between 1 and 10:

"if (num < 1 || num > 10)

{

     cout << "Your number is invalid" <<endl;

} else {

       cout << "Great you put a number between 1 and 10" <<endl;

}"

What does it say with words "If you put a number less than 1 or higher than 10 then it prints "Your number is invalid", or if your numbers is higher or equal to 1 and less or equal to 10 then it prints "Great your number is between 1 and 10".

So here you can se how easy is to use the else conditional and that it is very very useful when your are doing enourmous codes and your tired of writing or just because is not compplicated.

Hope you learn from this!

#Mastery17

1 min read

Here I am presentig you the which explains you how to use  a switch as a conditional.

I made  a video in youtube for you to understand it better, hope you enjoy!

https://www.youtube.com/watch?v=o32Y5ZBN7zM

#Mastery15

2 min read

Hello i am doing my al over again because i want to get my two points!

I will be teaching you how to use a conditional if.

First of all lets see why conditionals are useful.

For me personally, the use of conditionals is  one of the most important things in c++ programming or in any kind of language or algorithm. Because is such an easy way  to do things, or to lead the user where he wants to go.

An if or conditional, is to give the user an option if he wants something or no, or also if the user put something he can´t the program will say no, because you said tha IF he put that it will say no.

But, lets do an example for you to understand it better.

the syntax for using an if is very easy:

"if (conditional)

{

}"

Yes, is that simple.

But let say you ask the user for a number between 1 and  10 and the name of the variable that the user will give us is "num".

if (num < 1 || num > 10) //This is the condition

{

     cout << "Your number is invalid."  <<endl; //This is what the if will do if the conditon is true

}

So what did i did here. In words this tell "If the number the user gives is less than 1 or more than 10, then print (Your number is invalid).

As you can se is very simple and you cant put various times or combine it with for loops, while loops or whatever you want.

Hope you learn from this!

#Mastery28

1 min read

Hey everyone, in this post i will be explaining how to import or write in files on c++.

Cause is a tricky explanation i made a video in youtube so i hope you enjoy it.

PS. this was one of the most dificult things for me to learn, so i hope it will help you.

https://www.youtube.com/watch?v=PW9OYXnIBS0

#Mastery07

2 min read

Hi!

I am doing this mastery all over again because i wan to reach to 2 points.

I am teaching you how to put comments in c++.

Well first of all lets talk about why to use comments in codes? 

The answer is really simple, because sometimes you are making a code with other teammate or something like in the final project of Sudoku were you ra syncing with github, maybe the other guy modify somehting and you dont know what he had done so he put  a commento to et you know what does it mean.

Even if you´re alone the comments  will be useful when you want to try your program without a function or something but you are scared of deleting it, just put it as a comment an the problem is solved. Or when you don´t want to forget what you did or even when you are uploading to github, put a comment to let Ken know what is your doubt or what you´ve been doing.

With that said, lets see how does a comment is made.

There ar to kinds of comments

The first one is just by putting two slashes befor you write "//", the perk of this comment is that you can only use it in one line.

The second one is to put slash and asterisc at the beginning "/*" and then asterisc and slash at the end "*/", the good thing with this one is that you can use it in as many lines as you want.

Hope that this post is useful, enjoy it.

#WSQ17

2 min read

In this WSQ all we have to do it was download Scilab and play with it. So I did.

At first i didn´t have an idea of which use does Scilab had or what was the point of using it.

But i started reading the instructions and turns out it was a really fun program. I play by doing math and  some conditionals.

I really liked it, in the courses that i´m right now i am not shure if it would help a lot but i´m pretty sure that later in my career it would. In courses like math, elecricity, physics and other ones I´m shure it will be really helpful.

I wouls like to use this post to say thanks to my profesor Ken Bauer who i can honestly say  is one of the best teachers i ever had, becuase of his way of teaching which is Flipped Learning who makes you learn by yourself and be independent from your teachers, or just contact them when you really need them.

Just to make an example. This wsq isn´t really about c++ but is tool which can be really useful for some of us and Ken wants us to know how to use because of that.

Thanks for everything!

#MASTERY12 #Mastery12

1 min read

 

I´m goint to teach how to create a function in c++

First of all you have to choose which type of function you want.

Void = to return nothing.

Int = to return a integer number.

double = to return a decimal number.

bool = to return true or false

string = to return letters.

etc etc.

Well now that you know the types of functions you will have to select the  type you want for your variables which are pretty much the same.

Now, the syntax to do a function is:

type nameoffunction(variables, parameters)

{

}

--------------------------------------------

Let´s say, we want to create a function which make the sum of two integer numbers

int sumnum(int x, int y)

{

     int c;

     c = x + y;

     return c;

}

 

Hope you understand how to create a function, it is really easy and don´t be afraid to create them because it will save a lot of coding and your int main() will be a lot shorter.

 

Hope you understand so i can get my two points!

 

#MASTERY11 #Mastery11

1 min read

Here i will teach you how to call functions in c++.

First of all you will have to create a function and put parameters in it. And put what kind it is, if it´s int, bool, void etc..

To call it you will go to your int main and write the name of your function. Here is an example.

int function (int a,int b)

{

int c;

c = a + b;

return c;

}

int main()

{

function();

}

 

So you basically just put the function number and "()" or if it has parameters "(parameters)".

 

Hope you understand so i can have my two points!

#mastery04 #MASTERY04

2 min read

This mastery is to demsotrate how to upload work via Github but i will teach you how to do it.

1.-To begin with is you have to create a Github account which a supose you already have if your in Ken´s class.

2.- Second you will have to download the github app to your computer. link for windows (https://windows.github.com/).

3.- After you download it  go to the plus symbol "+" and click on clone.

4.- Now go to the web into your account and create a repository with any name you want.

5.- Now return to app and insert the url of the repository you created.

6.- After that choose a carpet in your documents were you have your codes (I suggest you to put your carpet and your repository the same name). 

7.- Click sync so it will sync with your carpet.

8.- Click were it  says, commits and do the commit or the change.

9.- Click sync again so it will upload to your repository in the web.

That is if you want to upload a file having the github app. In case your app doesn´t work or you don´t have it, go to the web, click on your repository and were it says "branchmaster" and your repositoriy´s name, is a plus symbol "+". Click there and select the file you want to sumbit.

 

I hope you understand so i can get my two points in this mastery!

 

#Wsq16 #WSQ16

1 min read

This is my link to my , it was an easy one because it was similar to the  project or the other ones. Thank you to my classmates for the help.

https://github.com/juancaglez/TC1017/blob/master/wsq16.cpp