示例#1
0
void Printer::programHeading(int s, int r, int d, char out, ofstream &outFile, string addString) {
    Modules mod;

    if (d == 1) d = 8;   //  " (right)" has 8 characters
    else if (d == -1) d = 7; // " (left)" has 7 characters
    else d = 0;

    fillDisplay('*', (r == 0 && s == -1) ? 52 + d : (r == 1 && s == -1) ? 40 + d :
            (r == 0 && s == 1) ? 37 + d : 25 + d); // nested ? : to determine '*' length
    cout << endl;
    if (r == 0 && s == -1)
        cout << "The Multiplication Table with Inversion in Rotation" + addString;  // add " (left) or " (right)"
    else if (r == 1 && s == -1)
        cout << "The Multiplication Table with Inversion";
    else if (r == 0 && s == 1)
        cout << "The Multiplication Table in Rotation" + addString;
    else
        cout << "The Multiplication Table";
    cout << endl;
    fillDisplay('*', (r == 0 && s == -1) ? 52 + d : (r == 1 && s == -1) ? 40 + d :
            (r == 0 && s == 1) ? 37 + d : 25 + d);
    cout << endl;

    if (out == 'y') {
        if (r == 0 && s == -1)
            outFile << "The Multiplication Table with Inversion in Rotation" + addString;
        else if (r == 1 && s == -1)
            outFile << "The Multiplication Table with Inversion";
        else if (r == 0 && s == 1)
            outFile << "The Multiplication Table in Rotation" + addString;
        else
            outFile << "The Multiplication Table";
        outFile << endl;

        for (int i = 0; i < mod.getRowSize(1); i++)
            outFile << TABLE[mod.getRow(i, 1)] << " ";
        outFile << " x   ";
        for (int i = 0; i < mod.getRowSize(2); i++)
            outFile << TABLE[mod.getRow(i, 2)] << " ";
        outFile << endl << endl;
    }
}
示例#2
0
void Printer::programHeading(char out, ofstream &outFile) {
    Modules mod;

    fillDisplay('*', 14);
    cout << endl << "The Prime Set" << endl;
    fillDisplay('*', 14);
    cout << endl;

    if (out == 'y') {
        outFile << "The Prime Set" << endl;
        for (int i = 0; i < mod.getRowSize(1); i++)
            outFile << TABLE[mod.getRow(i, 5)] << " ";
        outFile << endl << endl;
    }
}