কম্পিউটার টিউটোরিয়াল

C++ STL-এ iswspace() ফাংশন

এই আর্টিকেলে আমরা C++-এ iswspace() ফাংশনের সিনট্যাক্স, কাজকর্ম এবং রিটার্ন ভ্যালু নিয়ে আলোচনা করব।

iswspace() ফাংশনটি C++-এ একটি বিল্ট-ইন ফাংশন যা <cwctype> হেডার ফাইলে ডিফাইন করা আছে। এই ফাংশন চেক করে যে পাস করা ওয়াইড ক্যারেক্টারটি হোয়াইট স্পেস ক্যারেক্টার (স্পেস, ট্যাব, নিউলাইন ইত্যাদি) কিনা। এটি isspace()-এর ওয়াইড ক্যারেক্টার সমতুল্য। আর্গুমেন্ট হোয়াইট স্পেস হলে নন-জিরো ইন্টিজার (true), অন্যথায় শূন্য (false) রিটার্ন করে।

সিনট্যাক্স

int iswspace(wint_t ch);

ফাংশনটি শুধু একটি প্যারামিটার গ্রহণ করে: চেক করার জন্য ওয়াইড ক্যারেক্টার।

রিটার্ন ভ্যালু

ফাংশনটি একটি ইন্টিজার ভ্যালু রিটার্ন করে: ০ (false) অথবা নন-জিরো (true)।

উদাহরণ ১

#include <iostream>
#include <cwctype>
using namespace std;

int main() {
    wint_t a = L'.';
    wint_t b = L' ';
    wint_t c = L'1';
    iswspace(a) ? cout << "\nIts white space character" : cout << "\nNot white space character";
    iswspace(b) ? cout << "\nIts white space character" : cout << "\nNot white space character";
    iswspace(c) ? cout << "\nIts white space character" : cout << "\nNot white space character";
    return 0;
}

আউটপুট

Not white space character
Its white space character
Not white space character

উদাহরণ ২: স্ট্রিংএ হোয়াইট স্পেস কাউন্ট

#include <iostream>
#include <cwctype>
using namespace std;

int main() {
    int i = 0, count = 0;
    wchar_t s[] = L"I am visiting tutorials point";
    while (s[i]) {
        if (iswspace(s[i]))
            count++;
        i++;
    }
    cout << "There are " << count << " white space characters.\n";
    return 0;
}

আউটপুট

There are 4 white space characters.
  1. C++ STL-এ tanh() ফাংশন

  2. C++ STL-এ atanh() ফাংশন

  3. C++ STL-এ cosh() ফাংশন

  4. C++ STL-এ sinh() ফাংশন