Wednesday, November 15, 2017

How to set all of the element of an array as 0 in c++ programming

Using memset keyword we can set 0 for all index of an array .

we can don  it in two different way

1 .
    int  array[5] = {0,0,0,0,0};

2 .
   #include<bits/stdc++.h>
using namespace std;
int main()
{
    int array[5];

    memset(a, 0, sizeof(a));    // This is the line where we set 0 as value for all index of the array

    for(int i=0; i<5; i++){
        cout<<" "<<array[i];
    }
    cout<<endl;

    return 0;
}

Tuesday, November 14, 2017

C++ program to Calculate Factorial Using Recursion

    This program takes a positive integer from user and calculates the factorial of that number. Suppose, user enters 6 then,
Factorial will be equal to 1*2*3*4*5*6 = 720
You'll learn to find the factorial of a number using a recursive function in this example.
If you face any problem with the code please put your question into the comment box below....

    #include <bits/stdc++.h>

    using namespace std;

    int factorial(int n) {
        if(n > 1)
            return n * factorial(n-1);
        else
            return 1;
    }
    int main() {
        int n;
        cin >> n;
        int result = factorial(n);
        cout << result << endl;
        return 0;
    }

Monday, November 13, 2017

Stringstream in c++ and its operator and method...

stringstream is a stream class to operate on strings. It basically implements input/output operations on memory (string) based streams. stringstream can be helpful in different type of parsing. The following operators/functions are commonly used here
  • Operator >> Extracts formatted data.
  • Operator << Inserts formatted data.
  • Method str() Gets the contents of underlying string device object.
  • Method str(string) Sets the contents of underlying string device object.
Its header file is sstream.

Sunday, November 12, 2017

ডাটা স্ট্রাকচার কি ?

ডাটা স্ট্রাকচার কোন নির্দিষ্ট প্রোগ্রামিং ভাষা নয় । প্রোগ্রামিংইয়ে  ডাটা  নিয়ে  কাজ  করতে  ডাটা স্ট্রাকচারের  বিকল্প  নেই ।

ডাটা স্ট্রাকচার সাধারণত  দুই  ধরনের  ...
    ১  রৈখিক ।  ( Linear )
             Linear Array  হচ্ছে  রৈখিক  ডাটা  স্ট্রাকচার  এর  একটি  উদাহরণ । কারন  লিনিয়ার  Array                 তে  ডাটা  রৈখিক  ভাবে  অবস্থান  করে  ।

    ২ অরৈখিক । ( Non-linear )
             ট্রি  ,  গ্রাফ  হলো  অরৈখিক  ডাটা  স্ট্রাকচারের  উদাহরণ ।

প্রোগ্রামিং  এ  প্রোগ্রামারদের  সারাক্ষণই  বিভিন্ন  ডাটা  নিয়ে  কাজ  করতে  হয় । প্রোগ্রাম  দ্রুত  কাজ  করার  জন্য  এবং  প্রোগ্রামের  মেমোরি  কমিয়ে  আনার  জন্য  আমাদের  ডাটা  স্ট্রাকচার  সম্পর্কে  ভাল  জ্ঞান  থাকা  প্রয়োজন  ।

ডাটা  স্ট্রাকচার  নিয়ে  একটি  সম্পূর্ণ  ধারাবাহিক  লিখা  প্রকাশিত  হবে  ।



কম্পিউটার প্রোগ্রামিং শেখা কতটা গুরুত্বপূর্ণ ?

প্রোগ্রামিং কতটা গুরুত্বপূর্ণ? কম্পিউটার বিজ্ঞানের অনেক বড় একটা অংশ জুড়েই রয়েছে প্রোগ্রামিংয়ের দখল। প্রোগ্রামিং ছাড়া আমর...