Akansha Kumari has Published 81 Articles

What is the difference between cin and cout streams in c++?

Akansha Kumari

Akansha Kumari

Updated on 05-May-2025 17:05:21

17K+ Views

cin is an object of the input stream and is used to take input from input streams like files, console, etc. cout is an object of the output stream that is used to show output. Basically, cin is an input statement while cout is an output statement.They also use different ... Read More

What is the difference between \\"std::endl\\" and \\"\\" in C++?

Akansha Kumari

Akansha Kumari

Updated on 02-May-2025 19:20:57

481 Views

In C++, both std::endl and are used for inserting a newline in the output stream. However, std::endl also clears the output buffer by sending all the stored output to the screen. In this article, we will see a detailed comparison along with a table and discuss the scenarios where ... Read More

What is the difference between cerr and cout streams in c++?

Akansha Kumari

Akansha Kumari

Updated on 02-May-2025 18:48:58

4K+ Views

cout is an object of the stdout stream, while cerr is an object of the stderr stream.stdout and stderr are different streams, even though they both refer to console output by default. Redirecting (piping) one of them (e.g., program.exe >out.txt) would not affect the other. These are both provided by the ... Read More

Overload unary minus operator in C++?

Akansha Kumari

Akansha Kumari

Updated on 02-May-2025 18:48:25

8K+ Views

Unary operators are operators that operate only on a single operand (unlike binary operators, which operate on two operands). There are mainly thirteen unary operators that exist in C++, for example, ++, !, ~, typeof, delete, etc. Overloading Unary Minus Operator Overloading a unary operator means defining a custom behavior ... Read More

Difference between Relational operator(==) and std::string::compare() in C++

Akansha Kumari

Akansha Kumari

Updated on 30-Apr-2025 20:27:24

418 Views

In C++, both relational Operators (==) with std::string and std::string::compare() are used to compare two strings for equality, but there's a minor difference in both of these; == compares and returns the results in Boolean, whereas compare() checks lexicographically and returns the result in integers. In ... Read More

Semicolons in C++

Akansha Kumari

Akansha Kumari

Updated on 30-Apr-2025 20:26:37

1K+ Views

A semicolon in C++ is used to terminate or end the statement; it tells the compiler that this particular instruction is completed.According to the ISO C++ specifications, the lexical representation of C++ programs (breaking down code into small parts) is called tokens. Some of these tokens are punctuators, which are ... Read More

Overloading unary operators + in C++

Akansha Kumari

Akansha Kumari

Updated on 28-Apr-2025 19:03:29

359 Views

The unary operators are operators that operate only on a single operand. There are mainly thirteen unary operators in C++, for example, ++, !, ~, typeof, delete, etc.Overloading a unary operator means setting a customized behaviour for the unary operators for the objects of a class. which means you can define ... Read More

C program to Implement Kadane’s Algorithm

C
Akansha Kumari

Akansha Kumari

Updated on 25-Apr-2025 14:13:32

249 Views

We are given an array of integers, and we need to find the maximum sum of a contiguous subarray using Kadane’s Algorithm. Kadane’s Algorithm is an efficient way to find the maximum subarray sum in O(n) time complexity. For example, in the array {-2, 1, -3, 4, -1, 2, 1, ... Read More

Putting semicolons after while and if statements in C++

Akansha Kumari

Akansha Kumari

Updated on 23-Apr-2025 19:19:08

3K+ Views

In C++, a semicolon(;) indicates the end of a statement in code, or we can say it terminates the statement. When you use a semicolon just after an if or while statement, it creates an empty statement, which executes nothing. Semicolon with If Statement In C++, the if statement is ... Read More

Trigraphs in C++

Akansha Kumari

Akansha Kumari

Updated on 22-Apr-2025 18:50:06

323 Views

Trigraphs in C++ are special three-character sequences that represent a certain single character, which may not be available on some keyboards or systems. Previously, the ISO-646 character set did not have all the characters of the C syntax; therefore, some systems with their keyboard and display faced problems while dealing ... Read More

Advertisements