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

C/C++-এ iswgraph() ফাংশন উদাহরণসহ

এই আর্টিকেলে আমরা C++ STL-এ iswgraph() ফাংশনের কাজ, সিনট্যাক্স এবং উদাহরণ নিয়ে আলোচনা করব।

iswgraph() হলো একটি ফাংশন যা <cwctype> হেডার ফাইলের অধীনে আসে। এই ফাংশনটি ব্যবহার করা হয় দেওয়া ওয়াইড ক্যারেক্টারের কোনো গ্রাফিক্যাল রিপ্রেজেন্টেশন আছে কিনা তা চেক করার জন্য। এই ফাংশনটি <cctype> হেডার ফাইলের অধীনে আসা isgraph ফাংশনের ওয়াইড ক্যারেক্টার ভার্সন।

কौন ওয়াইড ক্যারেক্টারগুলো গ্রাফিক্যাল রিপ্রেজেন্টেশন রাখে?

সभी ওয়াইড ক্যারেক্টার যা স্ক্রিনে প্রিন্ট করা যায় সেসব গ্রাফিক্যাল রিপ্রেজেন্টেশন রাখে। এস্কেপ ক্যারেক্টারগুলো বাদে সবই গ্রাফিক্যাল রিপ্রেজেন্টেশন রাখে।

সিনট্যাক্স

int iswgraph(ch);

প্যারামিটারস

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

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

এটি একটি ইন্টিজার মান রিটার্ন করে অর্থাৎ ০ যদি ওয়াইড ক্যারেক্টারটি গ্রাফিক্যালি রিপ্রেজেন্টেড না হয় এবং নন-জিরো মান যদি ওয়াইড ক্যারেক্টারটি গ্রাফিক্যালি রিপ্রেজেন্টেড হয়।

উদাহরণ

Input: iswgraph('?'); Output: It has a graphical representation.
Input: iswgraph(' '); Output: It doesn't have a graphical representation.

উদাহরণ

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

int main() {
    wchar_t ch_1 = '%';
    wchar_t ch_2 = ')';
    if(iswgraph(ch_1))
        wcout<< "It has graphical representation: " << ch_1;
    else
        wcout<< "It doesn't have graphical representation: " << ch_1;
    if (iswgraph(ch_2))
        wcout<< "\nIt has graphical representation: " << ch_2;
    else
        wcout<< "\nIt doesn't have graphical representation: " << ch_2;
    return 0;
}

আউটপুট

It has graphical representation: %
It has graphical representation: )

উদাহরণ

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

int main() {
    wchar_t ch_1 = '9';
    wchar_t ch_2 = '/n';
    if(iswgraph(ch_1))
        wcout<< "It has graphical representation: " << ch_1;
    else
        wcout<< "It doesn't have graphical representation: " << ch_1;
    if (iswgraph(ch_2))
        wcout<< "\nIt has graphical representation: " << ch_2;
    else
        wcout<< "\nIt doesn't have graphical representation: " << ch_2;
    return 0;
}

আউটপুট

It has graphical representation: 9
It doesn't have graphical representation: ?
  1. ডাবল ট্রি উদাহরণসহ C++ প্রোগ্রামে

  2. ডিসেরিয়াম নম্বর উদাহরণসহ C++ প্রোগ্রামে

  3. সি++-এ ডিজোরিয়াম নম্বর উদাহরণসহ

  4. C++-এ ৩n স্লাইস পিজা (Pizza With 3n Slices)