answersLogoWhite

0

#include <iostream>

void printSet(int array[],int size){

int i;

for (i=1;i<=size;i++)

std::cout << array[i] << " ";

std::cout << std::endl;

return;

}

void printPowerset (int n){

int stack[10],k;

stack[0]=0; /* 0 is not considered as part of the set */

k = 0;

while(1){

if (stack[k]<n){

stack[k+1] = stack[k] + 1;

k++;

}

else{

stack[k-1]++;

k--;

}

if (k==0)

break;

printSet(stack,k);

}

return;

}

int main(){

printPowerset(4);

return 0;

}

User Avatar

Wiki User

12y ago

What else can I help you with?

Continue Learning about Engineering

How do you write a program to read set of numbers using by an array and display the ascending order of the given input numbers?

To write a C++ program to display the student details using class and array of object.


How do you carry out optimal power flow for a ieee 30 bus system?

It depends on the program you are using. If you are using PSAT for academic study, then your data have to be in m-file after conversion from simulink. If you are using commercial program like NEPLAN, then your data have to be in nepprj file. A NEPLAN data can not be used in PSAT program unless you have a measn to do the conversion. to properly run optimal power flow (OPF), make sure your power (load) flow runs. Then input your objective functions on generator being used or load. The objective function is determined like a*P^2+b*P+c, where a, b, and c are constants and P is the real power being generated. Same applies to reactive power pricing. So, all you need do after you set up power flow is to model your objective function this way. Some programs also model objective function as volatage var or loss. But all has cost modeling also as objective function. With this set up, your OPF program will run. hope this answers your question.


How many KVA of genset to produce 10000watts?

A gen set will be rated for a certain kVA at a certain power factor, or certain kW at a certain power factor. If rated in kVA, the power factor indicates the amount of real power you will get (ie if rated at 10,000kVA at .95 pf, the gen set can generate .95 x 10,000kW, or 9,500kW).


How do you set up a phantom power supply for a condenser microphone?

To set up a phantom power supply for a condenser microphone, first ensure that the microphone is compatible with phantom power (typically 48V). Connect the microphone to the input of the phantom power supply using an XLR cable. Then, connect the output of the phantom power supply to your audio interface or mixer, also using an XLR cable. Finally, turn on the phantom power on the supply to provide the necessary voltage for the microphone to operate.


How long does it take to set up a program on a computer?

Depends on the program and what you mean by "set up." It could be several seconds to several hours.

Related Questions

Can EXCEL generate different permitations?

Using the Permut function, you can find out how many permutations can be got from a set of values. To actually generate the individual permutations you would need a program.


How can you generate equivalent fractions by using set models?

14 -21


Using this power each state is allowed to set the speed limit on its roads.?

reserved power


How do you set the microwave power level?

To set the microwave power level, press the &quot;Power Level&quot; button on the microwave control panel and then select the desired power level using the keypad or dial.


How do you write a program to read set of numbers using by an array and display the ascending order of the given input numbers?

To write a C++ program to display the student details using class and array of object.


What is a set of instruction?

Set of instructions is called a PROGRAM. And set of program is called a SOFTWARE.


How do you carry out optimal power flow for a ieee 30 bus system?

It depends on the program you are using. If you are using PSAT for academic study, then your data have to be in m-file after conversion from simulink. If you are using commercial program like NEPLAN, then your data have to be in nepprj file. A NEPLAN data can not be used in PSAT program unless you have a measn to do the conversion. to properly run optimal power flow (OPF), make sure your power (load) flow runs. Then input your objective functions on generator being used or load. The objective function is determined like a*P^2+b*P+c, where a, b, and c are constants and P is the real power being generated. Same applies to reactive power pricing. So, all you need do after you set up power flow is to model your objective function this way. Some programs also model objective function as volatage var or loss. But all has cost modeling also as objective function. With this set up, your OPF program will run. hope this answers your question.


What is a set of instructions called?

Set of instructions is called a PROGRAM. And set of program is called a SOFTWARE.


How do you program your car alarm remote to your car?

You can set your alarm to your car using the remote control exclusively for cars.


How many KVA of genset to produce 10000watts?

A gen set will be rated for a certain kVA at a certain power factor, or certain kW at a certain power factor. If rated in kVA, the power factor indicates the amount of real power you will get (ie if rated at 10,000kVA at .95 pf, the gen set can generate .95 x 10,000kW, or 9,500kW).


How do you program westinghouse T28424?

To program the Westinghouse T28424 thermostat, first, turn on the power and press the &quot;Menu&quot; button. Navigate through the options using the arrow keys to set the current time, date, and desired heating or cooling schedules. Once you've set your preferences, confirm each setting by pressing the &quot;Select&quot; or &quot;OK&quot; button. Finally, ensure the thermostat is set to the appropriate mode (heating or cooling) to activate your programmed settings.


By what program can you play ps2 game on your pc?

The program to play PS2 on your computer is an emulator and it is not easy to set up and is not going to be like using a PS2 to play the game or even like using the PC to Play a computer game.