daily pastebin goal
83%
SHARE
TWEET

Untitled

a guest Sep 21st, 2018 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "pch.h"
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. void func(double A[], char C[], double count,int i) {
  7.     if (count == 35) {
  8.         cout << "((((("<<A[0];
  9.         for (int i = 0; i < 5; i++) {
  10.             cout   << C[i] << A[i + 1] << ")";
  11.         }
  12.         cout << endl;
  13.        
  14.     }
  15.     if (i < 5) {
  16.         C[i] = '+';
  17.         func(A, C, count + A[i + 1], i + 1);
  18.         C[i] = '-';
  19.         func(A, C, count - A[i + 1], i + 1);
  20.         C[i] = '*';
  21.         func(A, C, count * A[i + 1], i + 1);
  22.         C[i] = '/';
  23.         func(A, C, count / A[i + 1], i + 1);
  24.     }
  25. }
  26.  
  27. int main()
  28. {
  29.     double A[] = {1, 2, 3, 4, 5, 6};
  30.    
  31.     char C[5];
  32.     func(A, C, A[0], 0);
  33.     system("pause");
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top