how to declare function with multiple parameter c++
C++
// overloaded function
#include <iostream>
using namespace std;
int operate (int a, int b)
{
return (a*b);
}
float operate (float a, float b)
{
return (a/b);
}
int main ()
{
int x=5,y=2;
float n=5.0,m=2.0;
cout << operate (x,y);
cout << "\n";
cout << operate (n,m);
cout << "\n";
return 0;
}
/*
//Using template->
#include <iostream>
using namespace std;
template<typename Yourname> //U can write class instead of typename
void print (Yourname value)
{
cout<<value;
}
int main()
{
print<int>(2); //you can also use-> print(2);
cout<<endl;
print("ali");
}
*/
Also in C++:
- Title
- how to add a number after each number in an array with a for loop in C++
- Category
- C++
- Title
- sort function in vector c++ stl
- Category
- C++
- Title
- how to make a n*n 2d dynamic array in c++
- Category
- C++
- Title
- c++ iterate over vector
- Category
- C++
- Title
- setbits
- Category
- C++
- Title
- foind th output c++
- Category
- C++
- Title
- C++ while
- Category
- C++
- Title
- sleep system function linux c++
- Category
- C++
- Title
- file reading c++
- Category
- C++
- Title
- initialization list c++
- Category
- C++
- Title
- array 2d to 1d
- Category
- C++
- Title
- bellman ford algorithm cp algorithm
- Category
- C++
- Title
- find all the palindrome substring in a given string
- Category
- C++
- Title
- lambda c++
- Category
- C++
- Title
- find_if c++ example
- Category
- C++
- Title
- -> cpp
- Category
- C++
- Title
- ternary operator c++
- Category
- C++
- Title
- hashmap in c++
- Category
- C++
- Title
- how to import getline in c++
- Category
- C++
- Title
- heap sort
- Category
- C++
- Title
- how to input multiple lines of a file in c++
- Category
- C++
- Title
- class in c++
- Category
- C++
- Title
- equal elements in two arrays in c++
- Category
- C++
- Title
- std::substring
- Category
- C++
- Title
- array sort c++
- Category
- C++
- Title
- how to convert number to string
- Category
- C++
- Title
- invalid types int int for array subscript c++
- Category
- C++
- Title
- pause the console c++
- Category
- C++
- Title
- c++ smart pointer 2d array
- Category
- C++
- Title
- check an stack is empty c++
- Category
- C++
- Title
- how to check a number in string
- Category
- C++
- Title
- gta san andreas
- Category
- C++
- Title
- select elements from array C++
- Category
- C++
- Title
- stack c++
- Category
- C++
- Title
- how to check the datatype of a variable in c++
- Category
- C++
- Title
- check if intent has extras
- Category
- C++
- Title
- stack function in cpp
- Category
- C++
- Title
- cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
- Category
- C++
- Title
- C++ user input
- Category
- C++
- Title
- subtracting two large numbers
- Category
- C++
- Title
- change int to string cpp
- Category
- C++
- Title
- char size length c++
- Category
- C++
- Title
- find_if c++
- Category
- C++
- Title
- longest common subsequence
- Category
- C++
- Title
- switch case sinax c++
- Category
- C++
- Title
- Runtime Error: Runtime ErrorAbort signal from abort(3) (SIGABRT)
- Category
- C++
- Title
- qt make widget ignore mouse events
- Category
- C++
- Title
- gfg bottom view of tree
- Category
- C++
- Title
- how to allocate on heap in c++
- Category
- C++
- Title
- gcd in c++
- Category
- C++
- Title
- c++ get ascii value of char
- Category
- C++
- Title
- sfml default program
- Category
- C++
- Title
- c++ initialise array
- Category
- C++
- Title
- use of strstr in c++
- Category
- C++
- Title
- arduino for command
- Category
- C++
- Title
- ue4 c++ enum
- Category
- C++
- Title
- vector last c++
- Category
- C++
- Title
- vector of string in c++
- Category
- C++
- Title
- create copy of range of string c++
- Category
- C++
- Title
- how to set an integer equal to the largest integer possible in c++
- Category
- C++
- Title
- what is meaning of 64 bit integer in c++
- Category
- C++
- Title
- never gonna give you up
- Category
- C++
- Title
- fast io c++ geeksforgeeks
- Category
- C++
- Title
- zeros of array c++
- Category
- C++
- Title
- quick sort predefined function in c++
- Category
- C++
- Title
- primeros numeors primos menores que
- Category
- C++
- Title
- using namespace std in c++
- Category
- C++
- Title
- make an x using asterisk c++
- Category
- C++
- Title
- reverse in vector c++
- Category
- C++
- Title
- c++ size_t
- Category
- C++
- Title
- insertion sort in c++ program
- Category
- C++
- Title
- solve linear equations geeksforgeeks
- Category
- C++
- Title
- c++ pause
- Category
- C++
- Title
- find number of 1s in a binary cv::mat image
- Category
- C++
- Title
- two elements with difference K in c++
- Category
- C++
- Title
- unordered_map of pair and int
- Category
- C++
- Title
- traverse a map
- Category
- C++
- Title
- c++ vector
- Category
- C++
- Title
- c++ template function
- Category
- C++
- Title
- set precision in c++
- Category
- C++
- Title
- reference function in c++
- Category
- C++
- Title
- char to string c++
- Category
- C++
- Title
- how to avoid tle in c++
- Category
- C++
- Title
- Check if a Number is Odd or Even using Bitwise Operators
- Category
- C++
- Title
- string to number in c++
- Category
- C++
- Title
- how to put a class in a .h file c++
- Category
- C++
- Title
- c++ class constructor
- Category
- C++
- Title
- tokenize string c++
- Category
- C++
- Title
- c++ code for polynomial addition
- Category
- C++
- Title
- how to convert string to int c++
- Category
- C++
- Title
- min in vector c++
- Category
- C++
- Title
- elseif c++
- Category
- C++
- Title
- how to delete a node c++
- Category
- C++
- Title
- merge sort in c++
- Category
- C++
- Title
- sub string of vector c++
- Category
- C++
- Title
- error: redefinition of ‘class Customer’
- Category
- C++
- Title
- C++ string format ctime
- Category
- C++
- Title
- c++ sort
- Category
- C++
- Title
- howt o initialize 3d vector in c++
- Category
- C++
- Title
- c++ program to find gcd of 3 numbers
- Category
- C++