Found 34489 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++

Paul Richard
Updated on 19-Jun-2020 05:27:03

813 Views

According to the ISO C++ specifications, The lexical representation of C++ programs includes a number of preprocessing tokens which are used in the syntax of the preprocessor or are converted into tokens for operators and punctuators. The semicolon is a punctuator in C++.A semicolon character is at the end of the following parts of a C++ grammar (not necessarily a complete list) −an expression-statementa do/while iteration-statementthe various jump-statementsthe simple-declarationThese are all part of the C++ grammar. You can read more about these statements in the ISO C++ specification.

Explicit type casting operator in C++

Daniol Thomas
Updated on 11-Feb-2020 05:33:34

497 Views

A type cast provides a method for explicit conversion of the type of an object in a specific situation. It can be used as a unary expression −( type-name ) cast-expressionThe compiler treats cast-expression as type type-name after a typecast has been made. Casts are used to convert objects of any scalar kind to or from the other scalar type. Explicit type casts are constrained by the same rules that determine the effects of implicit conversions. Additional restraints on casts could result from the actual sizes or representation of specific types example#include using namespace std; int main() {    float x ... Read More

Conditional ternary operator ( ?: ) in C++

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

493 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)?

Rama Giri
Updated on 11-Feb-2020 05:28:21

3K+ Views

Stream Manipulators are functions specifically designed to be used in conjunction with the insertion () operators on stream objects, for example −std::cout

Basics of C++ Programming Language?

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

487 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

3K+ 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

13K+ 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++?

Akshaya Akki
Updated on 11-Feb-2020 05:03:02

15K+ 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(

Comparison between endl and in C++

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

137 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

Advertisements