How to take input from user

Duration: 8 min

This video lesson is available to enrolled students.

Return to /learn/COGNIZANT-PREPARATION/technical-assessment/programming-in-c/c-by-yash-sir/asset-how-to-take-input-from-user after enrolling

Inside: a video lesson and guided study material.

Module outline

  1. Communication Round: Vocabulary, Subject Verb Agreement (Verb Noun Agreement), Tenses, Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Cloze Test (Cloze Passage), Sentence Correction (Error Correction), Sentence Completion (Fill in the blanks), Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Direct and Indirect Speech, Active Passive Voice (Voice), Verbal Analogy (Word Based Analogy), Articles, Preposition, Conjunction, Sentence Construction, English Writing Ability, Communication Assessment
  2. Quantitative Aptitude: Ratio and Proportion (Ratios), Divisibility Rules, Data Interpretation, Mixture and Alligation, Permutation and Combination, Logarithm, Number System, HCF LCM, Speed Time and Distance, Percentage, Average, Powers and Exponents (Surds and Indices), Time and Work, Mensuration and Geometry, Age Problems, Pipe and Cistern, Probability, Profit and Loss, Simple Interest and Compound Interest, Algebra
  3. Analytical and Logical Reasoning: Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Directions (Direction Test), Ranking, Order and Sequence, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Selection Decision Table (Decision Making), Logical Sequence Of Words, Puzzle Solving (Puzzles), Syllogisms, Seating Arrangements, Calendar, Clock, Blood Relations, Cubes & Dices, Venn Diagram, Analytical Reasoning (Counting Figures Reasoning)
  4. Cognizant Gaming Aptitude: Gamified / Game Based Aptitude
  5. Java (Cluster 1): Java
  6. ANSI SQL MySQL (Cluster 1,2,3): SQL
  7. HTML, CSS, JavaScript (Cluster 1,3): HTML, CSS, JavaScript
  8. Python (Cluster 2): Python for Placements by Yash Sir
  9. Cloud Fundamentals (Cluster 2): Emerging Tech Trends
  10. C# (Cluster 3): C#
  11. OOPs: Object Oriented Programming (OOPS)
  12. Technical Assessment (Coding): Coding Questions by Yash Sir, C Programming by Yash Sir, Programming in C++, Pseudo Codes
  13. Data Structures: Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs, Hashing
  14. DBMS: Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Decomposition Properties & 4NF, File Organization & Indexing, Relational Algebra, Relational Calculus, Transaction Management, Concurrency Control, Database Recovery, ORDBMS, Database Security & Authorization, Query Processing & Optimization, Enhanced Data Models, Data Warehousing & Mining, Big Data Systems, NoSQL
  15. Operating Systems: Introduction to OS, Process Management, CPU Scheduling, Process Synchronization, Deadlock, Threads & Process Creation, Memory Management, Virtual Memory, Disc Scheduling, File Management, Windows OS, Linux OS, Security, Distributed Systems, Virtual Machines
  16. Computer Networks: Introduction to CN, Data Communication, DLL: Access Control, DLL: Flow Control, DLL: Error Control, DLL: Framing, Data Link Layer - Ethernet, Net Layer: IPv4 & Proto, Net Layer: IP Addressing, Net Layer:Routing Protocol, Transport Layer Services, TL: Congestion & UDP, Application Layer, Hardware basics, Network Security, Mobile Technology, Cloud Computing and IoT, Cyber and Info Security
AI summary & chapters

AI Summary

An AI-generated summary of this video lecture.

This educational video is a C++ programming tutorial that demonstrates how to write a program to calculate the square of a number. The instructor begins by showing a basic C++ program in an online IDE, which includes the necessary header files and the main function. The initial code uses a hardcoded value for the number, but the instructor then modifies it to accept user input using the cin statement. The program is executed with different inputs, such as 5 and 10, to show the output. The tutorial then transitions to a more advanced example, where the program calculates a number raised to a power, requiring the user to input both the base and the exponent. The instructor also shows how to use the pow() function from the math.h library to perform this calculation. The video includes a brief interlude where the instructor searches for the formula for the area of an equilateral triangle, which is presented as a visual aid. The overall teaching style is practical and hands-on, focusing on writing, modifying, and running code in real-time.

Chapters

  1. 0:00 – 2:00 00:00-02:00

    The video opens with a C++ code editor displaying a program to calculate the square of a number. The code includes the necessary headers #include <iostream> and using namespace std; and defines the main function. The instructor explains the structure of a C++ program. The initial code has a float variable x initialized to 5, and it prints the square of x. The instructor then modifies the code to prompt the user to enter a number, using cout to display "Enter Number:" and cin to read the input into the variable x. The output statement is updated to print the square of the entered number. The instructor runs the program, and the console output shows the result for the input 5, which is 25. The instructor also mentions that the program can be run with different values, such as 10, to get the square of 100.

  2. 2:00 – 5:00 02:00-05:00

    The instructor continues to demonstrate the C++ program for calculating the square of a number. The code is shown with the variable x initialized to 10, and the program is run to show the output of 100. The instructor then modifies the code to use the pow() function from the math.h library to calculate the square, which is shown as pow(x,2). The instructor explains that this method is more flexible for calculating powers other than 2. The video then transitions to a new topic, showing a Google search for the formula of the area of an equilateral triangle. The formula A = (√3/4) * a² is displayed, along with a diagram of the triangle. The instructor uses this as an example to illustrate how to apply the concept of calculating powers in a real-world scenario, such as calculating the area of a triangle with a given side length.

  3. 5:00 – 8:18 05:00-08:18

    The video returns to the C++ code editor, where the instructor demonstrates a more advanced program to calculate a number raised to a power. The code includes the necessary headers, including #include <math.h>. The program prompts the user to enter a number and a power, and then calculates the result using the pow() function. The instructor shows the code being written and executed, with the console output displaying the result of 5 raised to the power of 4, which is 625. The instructor explains that this method is more efficient than manually multiplying the number by itself multiple times. The video concludes with the instructor summarizing the key concepts covered, including how to take user input, perform calculations, and use the pow() function in C++.

The video provides a comprehensive, step-by-step tutorial on C++ programming, starting with the basics of writing a program to calculate the square of a number and progressing to more advanced concepts like user input and using the pow() function. The instructor uses a practical, hands-on approach, demonstrating code modifications and running the program to show the results. The inclusion of a real-world example, the area of an equilateral triangle, helps to contextualize the mathematical operations. The overall lesson emphasizes the importance of understanding the structure of a C++ program, how to interact with the user, and how to use built-in functions to perform complex calculations efficiently.

Loading lesson…