谁有PASCAL语言的回朔算法教程?急求!!!

来源:百度知道 编辑:UC知道 时间:2024/06/11 08:21:30
最好详细一点。

给你一个C++的看一下

#include <iostream>
#include <cstdlib>
#include <stack>
using namespace std;

int
number (int n);

int
main ()
{
cout << "Please input a number:";
int n;
cin >> n;
if (n < 1)
{
cout << "Error!" << endl;
system ("Pause");
return 1;
}

cout << "The result is: " << number (n) << endl;

system ("Pause");
return 0;
}

struct foo
{
int n; // the number
int m; // the m
int i; // the i
int v; // return value
bool b;
};

int
number (int n)
{