Category
š
LearningTranscript
00:00Hello everyone. Today I'm going to explain get care and the put care methods or you can
00:10say the get care and put care functions. We have used in our program the scanf and the
00:18printf function and we know that the scanf function is to read the value from the keyboard,
00:26to read the data from the keyboard and the printf function is used to display the data
00:32on the screen, to display the values on the screen. In the same way the get care and the
00:38put care function works, if we have to read the characters, so reading a character that
00:45can be done with the help of the get care. We can use scanf also but if we have to only
00:54read a single character then in spite of using scanf we can use the get care and if we have
01:00to write the character on the screen or you have to display the character on the screen
01:05then there is what put care method or you can say the put care function. So writing
01:10a character on the screen that can be done by the using of put care. So I'm going to
01:16explain the programs of it, first of all I'm going to explain the program of get care and
01:23then I'm going to explain the program of put care. Let me open the program, that of get care.
01:35So this is the program of get care and it's a very simple program and the program is to
01:49input the value from the keyboard and on the basis of value it's going to display a message.
01:58So here if you see I have taken one of the variable a, inside the printf I have written
02:04a statement that is a message that is to input y for yes and n for no. Now when I input a
02:13single character that character will be read by the function get care and this function
02:20is going to store the character value inside the variable a. If I input a character value
02:31y in uppercase or in a lowercase either in a capital letter or in a small letter then
02:43the statement is going to satisfy. If the value of a is capital Y or if the value of
02:50a is small y so it's going to compare with the constants y. So if suppose I have input
02:59inside a a capital Y so capital Y equal equal to capital Y here the condition is true or if
03:07suppose I store the value of a small y then small y equal equal to small y here the condition is
03:14true. So if any one of the condition gets true the statement is going to display, this message
03:20is going to display and if I input any other alphabet suppose I input n for no either in
03:33small or a capital that value is going to store inside a. So this both the condition get false
03:38so it will come to the else part and it's going to display what to buy. So let me run the program
03:45and see is it going to work or not. First of all let us compile and see if there is any error.
03:51So it's not showing any error. If for this console window if it's not display so what you can do
04:07you can go to the view and here it shows what logs or you can press the F2 key so it's going
04:13to show you the console window. So it's showing what zero error zero warning. So there is no
04:20error in the program. Let me run the program. Now it's asking me to input the value when I
04:25press Y and press enter it's showing me welcome. One of the condition is fulfilled and if I again
04:34run the program and suppose if I input n in a capital letter and I press enter key so this
04:43condition gets false the statement ends display y. So this is the program of get care and with
04:54the help of get care function the operation is performed and we get the result. Now I'm
05:03going to explain the program of put care. This is the program of it. The program is very simple
05:19that I have to input one of the alphabet from the keyboard and if the alphabet which I input
05:26the character which I input that is in small letters then it's going to display in a capital
05:32letter and if it's in a capital letter then it's going to display in a small letters. So I have
05:40taken out the variable a one message is going to display to enter any alphabet. So with the help
05:46of get care function I am going to put the value a single character from the keyboard that is going
05:53to store inside a. Here is one of the predefined function is lower okay that will convert if the
06:04value it will take the value if it is lower then it's going to convert to upper and it's going to
06:17display and if the values is not lower so it's going to come to the else part and with the help
06:24of to lower it's going to convert into lower okay that is in small letters. So if the condition is
06:33true that is the if the alphabet which you have input that is in is lower that is in small letter
06:41that alphabet then with the help of to upper it's going to convert into capital letter okay and going
06:48to display on the screen with the help of put care function and suppose if you have input the alphabet
06:54in a capital letter so this condition will get false and it will come to the else part and with
06:59the help of put care function it's going to convert into small letter and going to display. So will
07:07this happen or not let us see I'm going to run the program. I'm going to store I'm going to input
07:15the value in a capital letter a and I press enter it should mean a small letter okay the a in a
07:23lowercase and if I again run the program and this time I input the alphabet in a small letter and
07:34I press the enter key it's converted into capital letter that is in uppercase okay.
07:40So I hope you understand how to use the get care and the put care function. Thank you.