How to take multiple input from user
Duration: 5 min
This video lesson is available to enrolled students.
Inside: a video lesson and guided study material.
Module outline
- TCS One Shot Free Videos & Notes: TCS Preparation
- Numerical Ability (Foundation Section): Ratio and Proportion (Ratios), Divisibility Rules, Data Interpretation, Mixture and Alligation, Permutation and Combination, Logarithm, Number System, HCF LCM, Sequence and Series (Series), Speed Time and Distance, Percentage, Average, Powers and Exponents (Surds and Indices), Algebra, Probability, Profit and Loss, Simple Interest and Compound Interest, Time and Work, Pipe and Cistern, Mensuration and Geometry, Mental Ability, Age Problems, Statistics, Arithmetic, Partnership, Speed Mathematics and Basic Mathematics
- Reasoning Ability (Foundation Section): Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Syllogisms, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Seating Arrangements, Blood Relations, Directions (Direction Test), Analytical Reasoning (Counting Figures Reasoning), Puzzle Solving (Puzzles), Calendar, Clock, Cubes & Dices, Selection Decision Table (Decision Making), Crypt Arithmetic, Venn Diagram, Data Arrangement, Inequality, Analogy, Ranking, Order and Sequence, Logical Sequence Of Words
- New Pattern-Verbal Ability (Foundation Section): Sentence Completion (Fill in the blanks), English Writing Ability
- Old Pattern-Verbal Ability (Foundation Section): Vocabulary, Noun, Subject Verb Agreement (Verb Noun Agreement), Adjectives, Tenses, Pronoun, Preposition, Articles, Direct and Indirect Speech, Conjunction, Modals, Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Sentence Correction (Error Correction), Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Verbal Analogy (Word Based Analogy), Active Passive Voice (Voice), Determiner, Facts, Inference and Judgements, Adverb, Cloze Test (Cloze Passage), Sentence Construction, Verb
- Advanced Quantitative Ability: TCS NQT Advanced Quantitative Ability
- Advanced Reasoning Ability: TCS NQT Advanced Reasoning Ability
- Advanced Coding: Coding Questions by Yash Sir, C Programming by Yash Sir, Python for Placements by Yash Sir, DSA using Python, Object Oriented Programming (OOPS), Programming in C++, Java
- TCS Full Length Mock Test:
- TCS Interview & Resume Prep: MR & HR Interview Preparation, TCS Interview Preparation, Mock Interview, Interview Recordings, Resume Preparation, Resume Review
- Mega Test:
- Grand Test:
AI summary & chapters
AI Summary
An AI-generated summary of this video lecture.
This video is a C++ programming tutorial that demonstrates how to write a program to calculate the sum of two numbers. The instructor, Yash Jain, a coding expert, first presents a basic program that takes two integers as input from the user and outputs their sum. The code includes the necessary header files, uses the standard namespace, and defines the main function. The program prompts the user to enter two numbers, reads them using cin, and then prints the result using cout. The tutorial then transitions to a more advanced method, showing how to read two numbers separated by a space in a single input line. The instructor demonstrates this by modifying the code to use a single cin statement to read both numbers and then prints the sum. The video includes a live coding session with the program being compiled and executed, showing the input and output in a console window. The instructor explains the logic and syntax of the code, emphasizing the use of the iostream library and the cin and cout objects for input and output operations.
Chapters
0:00 – 2:00 00:00-02:00
The video begins with a C++ code editor displaying a program to calculate the sum of two numbers. The code includes the necessary headers and uses the standard namespace. The main function is defined, and two integer variables, 'first_number' and 'second_number', are declared. The program prompts the user to enter the first number with 'cout<<"Enter First Number: ";' and reads the input with 'cin>>first_number;'. It then prompts for the second number and reads it. The sum is calculated and printed using 'cout<<"Sum of "<<first_number<<" and "<<second_number<<" is "<<first_number+second_number;'. The instructor, Yash Jain, is visible in a circular frame, explaining the code. The code is then executed, showing the input and output in a console window, with the program successfully calculating the sum of 10 and 20 as 30.
2:00 – 4:43 02:00-04:43
The instructor modifies the code to demonstrate an alternative input method. The new code prompts the user to 'Enter Both Numbers followed by Space: ' and uses a single 'cin>>first_number>>second_number;' statement to read both numbers from a single line of input. The program then calculates and prints the sum. The instructor explains that this method is more efficient for reading multiple inputs on one line. The code is compiled and run, and the console shows the user entering '10 20', and the program correctly outputs 'Sum of 10 and 20 is 30'. The instructor also shows a test case with negative numbers, entering '-5 15', and the program correctly outputs 'Sum of -5 and 15 is 10'. The video concludes with the instructor summarizing the two methods for inputting multiple numbers in C++.
The video provides a clear, step-by-step tutorial on C++ input and output operations. It starts with a fundamental program that takes two numbers as separate inputs and calculates their sum, reinforcing basic syntax and the use of cin and cout. The instructor then builds upon this foundation by introducing a more efficient method for reading multiple inputs from a single line, demonstrating the versatility of the cin operator. This progression from a simple to a more advanced technique effectively teaches students how to handle different input formats in C++ programs, making it a practical lesson for beginners.

