⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xspctrm.cpp

📁 C++数值算法原书代码
💻 CPP
字号:
#include <fstream>
#include <iostream>
#include <iomanip>
#include "nr.h"
using namespace std;

// Driver for routine spctrm

int main(void)
{
        const int M=16;
        bool ovrlap;
        int j,k;
        Vec_DP p(M),q(M);
        ifstream fp("spctrl.dat");

        if (fp.fail())
          NR::nrerror("Data file spctrl.dat not found");
        k=8;
        ovrlap=true;
        NR::spctrm(fp,p,k,ovrlap);
        fp.seekg(0,ios_base::beg);
        k=16;
        ovrlap=false;
        NR::spctrm(fp,q,k,ovrlap);
        fp.close();
        cout << endl << "Spectrum of data in file spctrl.dat" << endl;
        cout << "index" << "        " << "overlapped " << "     " ;
        cout << "non-overlapped" << endl;
        cout << fixed << setprecision(6);
        for (j=0;j<M;j++) {
          cout << setw(3) << j << "      " << setw(13) << p[j];
          cout << "     " << setw(13) << q[j] << endl;
        }
        return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -