Relational operators c++ In Hindi

Relational operators c++ In Hindi

C++ प्रोग्रामिंग लैंग्वेज में रिलेशनल ऑपरेटर का यूज़ दो वैल्यू अलग अलग यूजर डिफाइन डिक्लेअर वेरिएबल वैल्यू या एक्सप्रेशन को आपस में कम्पेरिजन करने में किया जाता है। रिलेशनल ऑपरेटर एक बूलियन वैल्यू को रिप्रेजेंट (या तो ट्रू या फाल्स) वैल्यू को आउटपुट के रूप में रिटर्न करते हैं. यह कम्प्लीटली इस बात पर डिपेंड करता है कि यूजर डिफाइन दी गई प्रोग्राम में कम्पेरिजन कंडीशन कम्पलीट हुई है, या नहीं। रिलेशनल ऑपरेटर में कम्पेरिजन वैल्यू का ज्यादातर यूज़ if, while, और for लूप जैसे यूजर डिफाइन कंडीशनल स्टेटमेंट लॉजिक एक्सप्रेशन में कुछ स्पेसिफिक कंडीशन के बेस्ड पर किसी प्रोग्राम के डिफ़ॉल्ट फ्लो को कंट्रोल और मैनेज करने में किया जाता है।

Relational operators c++ In Hindi

Detail of Relational Operators

Operator symbolOperator NameOperator DescriptionExample
==Equal toHere it Returns output true if the both operands are same or equal variable value or identical.p == q
!=Not equal toHere it Returns output true if the operands are not equal or different from each other variable value.p != q
Greater thanHere it Returns output true if the left operand variable value is greater than the right value.p > q
Less thanHere it Returns output true if the left operand is less than to the right operand variable value.p < q
>=Greater than or equal toHere it Returns output true if the left operand is greater than or equal to the right operand value.p >= q
<=Less than or equal toHere it Returns output true if the left operand is less than or equal to the right operand value.p <= q

So, let’s get to know relational or comparison operators in the C++ programming language better.

Equals (==) Relational Operator in C++.

किसी भी C++ प्रोग्राम में इक्वल == ऑपरेटर यह चेक और एनालाइज करता है कि मौजूदा प्रोग्राम में यूजर डिफाइन दो वैल्यू आपस में इक्वल या एक समान हैं, या नहीं है।

Example of the Equals (==) relational operator.

#include <iostream>

using namespace std;

int main() {

    int p = 1, q = 1;

    if (p == q) {

        cout << “here p and q variable both value are equal.” << endl;

    }

    return 0;

}

Equals (==) relational operator explanation.

  • यहाँ इक्वल प्रोग्राम कंडीशन में  p == q कंडीशन चेक करता है कि p और q वैल्यू के बराबर है, या नहीं है। यहाँ दोनों वैल्यू 1 डिफाइन हैं. इसलिए इसका रिजल्ट ट्रू वैल्यू होगा।

Not Equal (!=) Relational Operator in C++.

किसी भी C++ प्रोग्राम में != नॉट इक्वल ऑपरेटर यह चेक या एनालाइज करता है कि यूजर डिफाइन डिक्लेअर वेरिएबल दो वैल्यू आपस में बराबर नहीं हैं, या नहीं है।

Example of the Not Equal (!=) relational operator.

#include <iostream>

using namespace std;

int main() {

    int p = 1, q = 2;

    if (p != q) {

        cout << “here p and q variable value are not equal.” << endl;

    }

    return 0;

}

Not Equal (!=) relational operator explanation.

  • यहाँ नॉट इक्वल प्रोग्राम कंडीशन में p != q एक्सप्रेशन यह चेक करता है कि p वेरिएबल q वेरिएबल के बराबर नहीं है. क्योंकि यहाँ p वेरिएबल वैल्यू 1 है, और q पैरामीटर वैल्यू 2 है. इस वजह से इसका रिज़ल्ट true आउटपुट होगा.

Greater Than (>) Relational Operator in C++.

किसी भी C++ प्रोग्राम में > ग्रेटर देन ऑपरेटर यह चेक और एनालाइज करता है कि यूजर डिफाइन दिए गए वेरिएबल वैल्यू में लेफ्ट ऑपरेंड वैल्यू राइट ऑपरेंड वैल्यू से ग्रेटर है, या नहीं है.

Example of the Greater Than (>) Relational Operator.

#include <iostream>

using namespace std;

int main() {

    int p = 2, q = 1;

    if (p > q) {

        cout << “here p value is greater than to the q variable value.” << endl;

    }

    return 0;

}

Greater Than (>) relational operator explanation.

  • यहाँ ग्रेटर देन प्रोग्राम कंडीशन में p > q एक्सप्रेशन यह चेक करता है कि यहाँ डिक्लेअर वेरिएबल p वैल्यू (2), q वेरिएबल वैल्यू (1) से ग्रेटर देन है, या नहीं है. और यह ट्रू है, इस कंडीशन का रिज़ल्ट true आउटपुट होगा.

Less Than (<) Relational Operator in C++.

किसी भी C++ प्रोग्राम में < लेस्स देन रिलेशनल ऑपरेटर यह चेक और एनालाइज करता है कि यूजर डिफाइन लेफ्ट ऑपरेंड वैल्यू, राइट ऑपरेंड वैल्यू से छोटा है, या नहीं है.

Example of the Less Than (<) Relational Operator.

#include <iostream>

using namespace std;

int main() {

    int p = 1, q = 2;

    if (p < q) {

        cout << “here p value is less than to the q variable value.” << endl;

    }

    return 0;

}

Less Than (<) relational operator explanation.

  • यहाँ लेस्स देन प्रोग्राम कंडीशन में p < q एक्सप्रेशन यह चेक करता है कि p (1) q (2) से लेस्स देन है, या नहीं है। और इसका रिज़ल्ट true आउटपुट होगा।

Greater Than or Equal to (>=) Relational Operator in C++.

किसी भी C++ प्रोग्राम में >= ग्रेटर देन इक्वल और टू ऑपरेटर यह चेक करता है कि लेफ्ट यूजर डिफाइन ऑपरेंड वैल्यू राइट ऑपरेंड वैल्यू से ग्रेटर है, या आपस में बराबर है, या नहीं है।

Example of the Greater Than or Equal to (>=) Relational Operator.

#include <iostream>

using namespace std;

int main() {

    int p = 1, q = 1;

    if (p >= q) {

        cout << “here p value is greater than or equal to q variable value.” << endl;

    }

    return 0;

}

Greater Than or Equal to (>=) relational operator explanation.

यहाँ ग्रेटर देन इक्वल और टू प्रोग्राम कंडीशन में p >= q एक्सप्रेशन यह चेक करता है कि p  (1) q (1) से गेटर देन इक्वल और टू है, या नहीं है। जैसा की यहाँ ये दोनों आपस में इक्वल हैं. इस वजह से इसका रिज़ल्ट आउटपुट true होगा।

Less Than or Equal to (<=) Relational Operator in C++.

किसी भी C++ प्रोग्राम में <= लेस देन और इक्वल टू ऑपरेटर यह चेक करता है कि यूजर डिफाइन प्रोग्राम एक्सप्रेशन लेफ्ट वेरिएबल ऑपरेंड वैल्यू राइट ऑपरेंड वैल्यू से लेस देन और इक्वल टू है, या नहीं है।

Example of the Less Than or Equal to (<=) Relational Operator.

#include <iostream>

using namespace std;

int main() {

    int p = 1, q = 2;

    if (p <= q) {

        cout << “here p variable value is less than or equal to q variable value.” << endl;

    }

    return 0;

}

Less Than or Equal to (<=) relational operator explanation.

यहाँ लेस देन और इक्वल टू प्रोग्राम कंडीशन में p <= q एक्सप्रेशन यह चेक करता है कि p (1) q (2) से लेस देन और इक्वल टू है,  या नहीं है। और इस एक्सप्रेशन का रिज़ल्ट true होगा।

Relational operators with different data types in C++ programming.

C++ प्रोग्राम में रिलेशनल ऑपरेटर का यूज़ मल्टीप्ल डेटा टाइप वेरिएबल वैल्यू, जैसे इंटीजर, फ्लोटिंग-पॉइंट नंबर, और यहां तक ​​कि स्ट्रिंग डाटा टाइप के साथ भी किया जा सकता है। जैसा की, यहाँ आपको इसे यूज़ करने से पहले कुछ बातो को ध्यान में रखना ज़रूरी है.

C++ प्रोग्राम में फ्लोटिंग-पॉइंट नंबर जैसे, फ्लोट या डबल डाटा टाइप में प्रिसिजन आउटपुट वैल्यू के इश्यूज हो सकते हैं. स्पेशली, जब कई बार उन न्यूमेरिक वैल्यू की तुलना की जाती है, जो एक-दूसरे के बहुत करीब होते हैं।

स्ट्रिंग्स डाटा टाइप में, रिलेशनल ऑपरेटर्स का यूज़ दो अलग अलग स्ट्रिंग्स के साथ किया जा सकता है. जहाँ इन यूजर डिफाइन स्ट्रिंग वैल्यू की तुलना लेक्सिकोग्राफ़िकल आर्डर में होती है. यहाँ दिए गए स्पेफिक स्ट्रिंग अल्फाबेटिकल ऑर्डर के अनुसार।

Example of comparing floating-point numbers.

#include <iostream>

using namespace std;

int main() {

    double p = 9.0, q = 9.0;

    if (p == q) {

        cout << “here p and q variable value are equal.” << endl;

    }

    return 0;

}

comparing floating-point relational operator explanation.

यहाँ आप इस फ्लोटिंग-पॉइंट नंबर्स प्रोगाम में तुलना करते समय, फ्लोटिंग आउटपुट प्रिसिजन वैल्यू इश्यूज़ के लिए कुछ टॉलरेंस (epsilon) की परमिशन प्रोवाइड की जाती है।

Example of comparing two text strings.

#include <iostream>

#include <string>

using namespace std;

int main() {

    string text1 = “c++”, text2 = “javascript”;

    if (text1 != text2) {

        cout << “here text1 string and text2 string are not equal.” << endl;

    }

    return 0;

}

comparing two text strings relational operator explanation.

यह दो स्ट्रिंग कम्पेरिजन != ऑपरेटर स्ट्रिंग्स की तुलना लेक्सिकोग्राफ़िकल आर्डर में करता है. जैसे, डिक्शनरी सीक्वेंस ऑर्डर में।

Detail explanation of Relational Operators

Operator symbolRelational Operators DescriptionExample
==Equal to operator – here it displays true result if the both users define operands value are same or equal.p == q
!=Not equal to operator – here it displays true if the both users define declare variable value operands are not equal.p != q
Greater than operator – here it displays true output result if the left user define operand value is greater than to the right operand value.p > q
Less than operator – here it displays true output result if the left operand value is less than the right operand value.p < q
>=Greater than or equal to operator – here it displays true output result if the left operand is greater than or equal to the right operand value.p >= q
<=Less than or equal to operator – here it displays true output result if the left operand is less than or equal to the right operand value.p <= q

Leave a Reply