C++ (Cpp) printf Examples

C++ (Cpp) printf - 30 examples found. These are the top rated real world C++ (Cpp) examples of printf extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
int main () {

    int i, j, n, indegree[10], a[10][10];

    printf("\nEnter the number of vertices : ");
    scanf("%d", &n);
    for (i = 0; i < n; i++)
        indegree[i] = 0;

    printf("\nEnter matrix : ");
    for (i = 0; i < n; i++)
        for (j = 0; j < n; j++) {
            scanf("%d", &a[i][j]);
            if (a[i][j] == 1)
                indegree[j]++;
        }

    Topo_sort (n, indegree, a);

    if (k != n)
        printf("\nTopological sorting not possible.");
    else {
        printf("\nThe topological order is ... \n");
        for (i = 0; i <= n; i++)
            printf("\t%d", temp[i]);
    }
    return 0;
}
void test_check_equal_should_return_zero_for_non_equal_int_values() {
    test_count++;

    printf("1 + 1 should not equal 2... ");
    assert(0 == check_equal(1 + 1, 1));
    printf("ok\n");
}
void test_assert_equal_should_quit_program_for_non_equal_int_values() {
    test_count++;

    printf("assert_equal(1, 2); should exit with status code 1... ");
    assert_equal(1, 2);
    printf("ok\n");
}
bool
SubdirsMetaMakefileGenerator::write(const QString &oldpwd)
{
    bool ret = true;
    const QString &pwd = qmake_getpwd();
    const QString &output_dir = Option::output_dir;
    const QString &output_name = Option::output.fileName();
    for(int i = 0; ret && i < subs.count(); i++) {
        const Subdir *sub = subs.at(i);
        qmake_setpwd(subs.at(i)->input_dir);
        Option::output_dir = QFileInfo(subs.at(i)->output_dir).absoluteFilePath();
        if(Option::output_dir.at(Option::output_dir.length()-1) != QLatin1Char('/'))
            Option::output_dir += QLatin1Char('/');
        Option::output.setFileName(subs.at(i)->output_file);
        if(i != subs.count()-1) {
            for (int ind = 0; ind < sub->indent; ++ind)
                printf(" ");
            printf("Writing %s\n", QDir::cleanPath(Option::output_dir+"/"+
                                                   Option::output.fileName()).toLatin1().constData());
        }
        QString writepwd = Option::fixPathToLocalOS(qmake_getpwd());
        if(!writepwd.startsWith(Option::fixPathToLocalOS(oldpwd)))
            writepwd = oldpwd;
        if(!(ret = subs.at(i)->makefile->write(writepwd)))
            break;
        //restore because I'm paranoid
        qmake_setpwd(pwd);
        Option::output.setFileName(output_name);
        Option::output_dir = output_dir;
    }
    return ret;
}
void printColor(float *values, int count) {
    int i;
    printf("color: ");
    for(i = 0; i < count; i++)
        printf("%.2f", *(values + i));
    printf("\n");
}
Example #6
0
void print_array(int *array, int size)
{
    int n;
    for(n = 0; n < size; n++)
        printf("%d ", array[n]);
    printf("\n");
}