Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

two questions in c++ required solution

Status
Not open for further replies.

yousefsam

Member level 1
Joined
May 18, 2006
Messages
37
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,288
Activity points
1,569
Plz help me to find the solution of two programs in C++:
1. program to creat array and save the values in it , and save the factorial of those values into another one (Using Array) .
2. program to creat a binary search.
 

Solution to c++ query !

/* :cry: The program is quite easy one */

#include<iostream>
#define MAX 10

using namespace std;

int fact(int n)
{
if(!n)
return 1;
else
return n*fact(n-1);
}

int main()
{
int num[MAX], fac[MAX];
for(int = 0;i<MAX;i++)
{
cout<<"Enter a Number: ";
cin>>num;
fac = fact(num);
}
cout<<endl<<"The Factorials r : "<<endl;
for(int = 0;i<MAX;i++)
cout<<fac<<endl;
return 0;
}

/* As easy as that ! :D*/
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top