Description: Basic output (printing) and input (text based) in C++.
Learning to print text in a code and let the user input some more of their own. We understand the andvantages of output and input in this mastery.
Link to video here.
]]>The main output function is called print(). This function basically lets you make your output look nicer and easier to read.
So you can basically take your input and save it in our variable “n” so you can reuse it using your output function print().
n = input(“Please enter your age: “)
Once we have our input, which is the user’s name. We can take it and print it.
n = input(“Please enter your age: “)
print(n)
But that isn’t too fun since we are basically repeating what the user said. We will put it inside the stringthat restates the obvious.
n = input(“Please enter your age: “)
print(“The user is ” + n + ” years old.”)
This looks better right? The correct answer is no because we didn’t convert our input into a string.
n = input(“Please enter your age: “)
print(“The user is ” + str(n )+ ” years old.”)
Overall, there isn’t much to the print() function, you just have to remember the type of data you are printing and handle it accordingly.
]]>Here is the link to my video:
]]>
Python has something called Built-in Functions, these are default functions that you will need to run a program correctly.
print() is used to show the result of a program to the user, for example if I want to show in the console a simple string I just need to write a simple print(“This is an output”) in my text editor or whatever you use to write code. Very important, don’t forget use the quotes.
To do this more clear here is some pictures…
This is the code
This is how it looks
]]>Here you go:
https://github.com/A01154027/TC101/blob/master/WSQ10.cpp
https://github.com/A01154027/TC101/blob/master/WSQ10.cpp
This is mastery #10. This is about input and output in C++. Easy topic. I decided I will use the voice of the last videos for all my videos. Here is my video: https://www.youtube.com/watch?v=lebP-UwsSkg
]]>This is mastery #10. This is about input and output in C++. Easy topic. I decided I will use the voice of the last videos for all my videos. Here is my video: https://www.youtube.com/watch?v=lebP-UwsSkg
]]>