00:01
Okay, so in this question we want to write a c+ + program to ask the user for a number and then return the number with a messaging if it's positive or negative or if the number is zero so here i have a basic a c+ + hello world program and if i build and run this program it will simply output hello world this is what we're going to use to start all you need to include is i -o -stream so input output stream which allows you to use the c -out functions which will help you print things in the console and c -n which allows you to take input and std stands for standard library so these are standard functions in c+ + that you can use and they're already well optimized and they're generally good practice to use in c+ + code.
01:12
So what we want to output as a message for now is not hello world, but it would be please enter a number.
01:30
And i don't even need a line return here.
01:33
I could just end my line.
01:35
Remember in c+ + you need a semicolon and a line.
01:40
So that will simply output a message like this.
01:45
Please enter a number, but it won't allow us to enter anything.
01:50
As you can see, the program has ended and press any key to continue, means it will close, finish the program.
02:00
Now to take an input, we need to use the c -n function.
02:06
But before using the c -n function, we need our variable.
02:09
So we're going to declare it as an integer called user number.
02:22
So now we just declare our integer user number.
02:27
We won't do anything with it.
02:30
Then we ask a user to enter a number.
02:33
And then we use the std -c -n function...