Found 33676 Articles for Programming

C++ Relational and Equality Operators

Srinivas Gorla
Updated on 11-Feb-2020 05:40:45

2K+ Views

In C Programming, the values hold on in 2 variables will be compared exploitation following operators and relation between them will be determined. These operators are called relational operators. Various C++ relational operators available are-OperatorsDescription>Greater than>=Greater than or equal to

Semicolons in C++

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 special symbols used to structure your code. The semicolon is one of these punctuators. Example Here is the following basic example code showcasing the working of a semicolon in C++. #include using namespace std; int main() { int x = 5; // End of declaration statement x = 10; // End of assignment statement cout

Conditional ternary operator ( ?: ) in C++

Abhinanda Shri
Updated on 11-Feb-2020 05:30:35

641 Views

The conditional operator (? :) is a ternary operator (it takes three operands). The conditional operator works as follows −The first operand is implicitly converted to bool. It is evaluated and all side effects are completed before continuing.If the first operand evaluates to true (1), the second operand is evaluated.If the first operand evaluates to false (0), the third operand is evaluated.The result of the conditional operator is the result of whichever operand is evaluated — the second or the third. Only one of the last two operands is evaluated in a conditional expression. The evaluation of the conditional operator ... Read More

What are C++ Manipulators (endl, setw, setprecision, setf)?

Akansha Kumari
Updated on 04-Jun-2025 13:33:54

4K+ Views

Manipulators in C++ are like helper functions that are designed to format and modify the input and output streams of your code. This is done by using the insertion () operators, and are defined in and header files. There are various types of manipulators that exist in C++, but in this article, we will be discussing the four main types, which are commonly used. endl setw setprecision setf C++ endl Manipulator The endl manipulator has the same functionality as ''(newline ... Read More

Basics of C++ Programming Language?

Kumar Varma
Updated on 11-Feb-2020 05:19:52

716 Views

C++ is a programming language developed by Bjarne Stroustrup in 1979 at Bell Labs. C++ is regarded as a middle-level language, as it comprises a combination of both high-level and low-level language features. It is a superset of C, and that virtually any legal C program is a legal C++ program. C++ runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX. It is a language that is −Statically typed − A programming language is said to use static typing when type checking is performed during compile-time as opposed to run-time.Compiled − A compiled ... Read More

Compound Assignment Operators in C++

Govinda Sai
Updated on 11-Feb-2020 05:10:31

4K+ Views

The compound assignment operators are specified in the form e1 op= e2, where e1 is a modifiable l-value not of const type and e2 is one of the following −An arithmetic typeA pointer, if op is + or –The e1 op= e2 form behaves as e1 = e1 op e2, but e1 is evaluated only once.The following are the compound assignment operators in C++ −OperatorsDescription*=Multiply the value of the first operand by the value of the second operand; store the result in the object specified by the first operand./=Divide the value of the first operand by the value of the ... Read More

Simple Arithmetic Operators Example Program In C++

Ramu Prasad
Updated on 11-Feb-2020 05:07:26

18K+ Views

C++ has 5 basic arithmetic operators. They are −Addition(+)Subtraction(-)Division(/)Multiplication(*)Modulo(%)These operators can operate on any arithmetic operations in C++. Let's have a look at an example −Example#include using namespace std; main() {    int a = 21;    int b = 10;    int c ;    c = a + b;    cout

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

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 operators. cin uses the insertion operator( >> ) while cout uses the extraction operator( >), which helps to extract the input from the cin and stores it in a variable. It automatically skips the whitespaces (spaces, tabs, newlines) until a special method like getline() is used. Syntax Here is the ... Read More

Comparison between endl and in C++

Arjun Thakur
Updated on 30-Jul-2019 22:30:21

218 Views

"" Outputs a newline (in the appropriate platform-specific representation, so it generates a "\r" on Windows), but std::endl does the same and flushes the stream. Usually, you don't need to flush the stream immediately and it'll just cost you performance, so, for the most part, there's no reason to use std::endl.When you want to flush the stream manually -- e.g. because you expect your output to be made visible to the user in a timely fashion -- you should use std::endl instead of writing '' to the stream (whether as an isolated character or part of a string). Read More

What is double address operator(&&) in C++?

Akansha Kumari
Updated on 05-May-2025 17:06:22

20K+ Views

&& is a new reference operator defined in the C++11 standard. int&& a means "a" is an r-value reference. && is normally only used to declare a parameter of a function. And it only takes an r-value expression.Simply put, an r-value is a value that doesn't have a memory address. E.g., the number 6 and character 'v' are both r-values. int a, a is an l-value, however, (a+2) is an r-value. Example #include using namespace std; void foo(int&& a) { cout

Advertisements