কম্পিউটার

C++ এবং এর অ্যাপ্লিকেশনগুলিতে মেকফাইল


এই টিউটোরিয়ালে, আমরা C++ এ মেকফাইল এবং এর অ্যাপ্লিকেশন বোঝার জন্য একটি প্রোগ্রাম নিয়ে আলোচনা করব।

কাজটি হল মেকফাইল দিয়ে পুরো প্রোগ্রামটি ভেঙে ফেলা। এটি সাধারণত .cpp ফাইল এবং .h ফাইলগুলিকে সমস্ত শ্রেণী/কার্যকারিতা সহ এবং সেগুলিকে একসাথে লিঙ্ক করার মাধ্যমে করা হয়৷

উদাহরণ

main.cpp

#include <bits/stdc++.h>
#include "function.h"
using namespace std;
//main execution program
int main(){
   int num1 = 1;
   int num2 = 2;
   cout << multiply(num1, num2) << endl;
   int num3 = 5;
   cout << factorial(num3) << endl;
   print();
}

print.cpp

#include <bits/stdc++.h>
#include "function.h"
using namespace std;
void print()
{
   cout < "makefile" << endl;
}

factorial.cpp

#include <bits/stdc++.h>
#include "function.h"
using namespace std;
//factorial program
int factorial(int n){
   if (n == 1)
      return 1;
   return n * factorial(n - 1);
}

multiply.cpp

#include <bits/stdc++.h>
#include "function.h"
using namespace std;
int multiply(int a, int b){
   return a * b;
}

functions.h

#ifndef FUNCTIONS_H
#define FUNCTIONS_H
void print();
int factorial(int);
int multiply(int, int);
#endif

আউটপুট

2
120
makefile

  1. C++ এ বৃত্ত এবং আয়তক্ষেত্র ওভারল্যাপিং

  2. C++-এ N বাইনারি স্ট্রিং-এর Bitwise AND

  3. C++ এ এক এবং শূন্য

  4. C++ এ ডোমিনো এবং ট্রোমিনো টাইলিং