Skip to content

tanishkaajadhav/BASIC_CPP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

(a) BASIC I/O OPERATIONS – JAIGANESH.cpp

AIM : To perform basic input and output operations in C++.

APPARATUS : Laptop with C++ compiler(MinGW), Text Editor / IDE (VS Code), Terminal/Console (Command Prompt).

THEORY : In C++, input and output are managed through the concept of streams. A stream is a sequence of bytes that represents a flow of data. The two most commonly used streams are:

cin (standard input stream) → used to accept data from the user.

cout (standard output stream) → used to display data to the user.

Additionally, getline() is used when input contains spaces, allowing the program to read an entire line of text. These operations are made available through the header file . Mastering basic I/O is essential, as it forms the foundation for user interaction in any C++ program.

ALGORITHM : Start the program and include necessary header files.

Declare variables for storing input.

Display message to the user using output statement.

Read input from the user using input statement.

Display the entered input using output statement.

Stop the program.

CONCLUSION : Basic input and output operations are successfully performed in C++.

(b) BASIC CALCULATOR – CALCULATOR.cpp

AIM : To implement a basic calculator program in C++ to perform arithmetic operations.

APPARATUS : Laptop with C++ compiler (MinGW), Text Editor / IDE (VS Code), Terminal / Console (Command Prompt).

THEORY : A calculator program demonstrates the use of arithmetic operators and control structures in C++. The arithmetic operators include:

  • (addition)
  • (subtraction)
  • (multiplication)

/ (division)

% (modulus, for integers)

The program accepts two operands and an operator, then uses decision-making constructs like if-else or switch-case to determine the operation to perform. Proper error handling (such as checking division by zero) ensures program reliability. This experiment helps understand the integration of operators, variables, and control flow to solve computational problems interactively.

ALGORITHM : Start the program and include necessary header files.

Declare variables for operands and operator.

Accept the first number from the user.

Accept the operator from the user.

Accept the second number from the user.

Use control structure to perform the chosen arithmetic operation.

Display the result.

Stop the program.

CONCLUSION : A basic calculator program is implemented successfully using C++.

A basic calculator program is implemented successfully using C++.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages