-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecfun.cpp
More file actions
50 lines (39 loc) · 1.07 KB
/
Copy pathrecfun.cpp
File metadata and controls
50 lines (39 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// recfun.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "pascal.h"
#include "parentheses.h"
#include "countchange.h"
#include <iostream>
//A #include <string>
#include <iterator>
// #include <algorithm>
//#include <ostream>
int _tmain(int argc, _TCHAR* argv[])
{
// CountChange
std::vector<int> coins;
int coi1[3] = {4, 1, 2};
coins.assign(coi1, coi1 + 3);
countChange(4, coins) == 4;
int coi4[7] = {500,5,50,100,20,200,10};
coins.assign(coi4, coi4 + 7);
countChange(300, coins) == 1022;
// for (int i=0;i<1000000;++i)
// pascal(3,11);
// if (pascal(3,11) == 165)
char* str1 = "(if (zero? x) max (/ 1 x))";
char* str2 = "())(";
std::vector<char> coll;
coll.assign(str1, str1 + strlen(str1));
// std::copy(coll.begin(), coll.end(), std::ostream_iterator<char> (std::cout, ""));
// std::cout << std::endl;
balance(coll);
coll.assign(str2, str2 + strlen(str2));
// std::copy(coll.begin(), coll.end(), std::ostream_iterator<char> (std::cout, ""));
// std::cout << std::endl;
if (balance(coll))
return 0;
else
return 1;
}