added function test with gcd calculation
This commit is contained in:
parent
41c83877a7
commit
79715ad9df
39
code/gcd.txt
Normal file
39
code/gcd.txt
Normal file
@ -0,0 +1,39 @@
|
||||
>main
|
||||
gto
|
||||
:gcd
|
||||
=v
|
||||
=u
|
||||
$u
|
||||
$v
|
||||
>loop
|
||||
gge
|
||||
$u
|
||||
=t
|
||||
$v
|
||||
=u
|
||||
$t
|
||||
=v
|
||||
:loop
|
||||
$v
|
||||
0
|
||||
>ret
|
||||
gle
|
||||
$v
|
||||
=t
|
||||
$u
|
||||
$v
|
||||
mod
|
||||
=v
|
||||
$t
|
||||
=u
|
||||
>loop
|
||||
gto
|
||||
:ret
|
||||
$u
|
||||
ret
|
||||
:main
|
||||
4
|
||||
16
|
||||
>gcd
|
||||
fun
|
||||
end
|
4
main.cpp
4
main.cpp
@ -68,7 +68,7 @@ int main(int argc, const char * argv[]) {
|
||||
|
||||
bool done {false};
|
||||
std::string base_url {"https://www.swiftcoder.nl/cpp1/"};
|
||||
std::string next_url {"start.txt"};
|
||||
std::string next_url {"gcd.txt"};
|
||||
std::string code;
|
||||
requester req;
|
||||
interpreter proc;
|
||||
@ -77,7 +77,7 @@ int main(int argc, const char * argv[]) {
|
||||
// std::cerr << code << '\n';
|
||||
std::istringstream in {code};
|
||||
next_url = proc.eval(in, done);
|
||||
std::cerr << next_url << '\n';
|
||||
SCInfo(logger, next_url);
|
||||
}
|
||||
std::cout << next_url << '\n';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user