Running programm in Dev-C++ appears as a blank screen, but not on Code::Blocks

89 Views Asked by At

So I have just recently started coding and I'm following a book for beginners on C language. One of the programms we learn to write is as follows below. After I compile and run with Dev-C++ it works, but on the console screen appears nothing.

I tried to run the exact same code through Code::Blocks and it works perfectly. Is there any particularity in Dev-C++ I don't know about?

I'll be adding the image of the console of both IDE's consoles.left Code::Blocks, right Dev-C++

Note: the book I'm using was wrote using Code::Blocks.

Note: all other programms I've wrote to this point in Dev-C++ work just fine. This one is the exception.

#include <stdio.h>

main()
{

// Set up the variables, as weel as define a few

char firstInitial, middleInitial;
int number_of_pencils;
int number_of_notebooks;
float pencils = 0.23;
float notebooks = 2.83;
float lunchbox = 4.99;

//The information for the first child
firstInitial = 'J';
middleInitial = 'R';

number_of_pencils = 7;
number_of_notebooks = 4;

printf("%c%c needs %d pencils, %d notebooks, and 1 lunchbox\n",
    firstInitial, middleInitial, number_of_pencils,
    number_of_notebooks);
printf("The total cost is $%.2f\n\n", number_of_pencils*pencils
+ number_of_notebooks*notebooks + lunchbox);

//The information for the second child
firstInitial = 'A';
middleInitial = 'T';

number_of_pencils = 9;
number_of_notebooks = 2;

printf("%c%c needs %d pencil, %d notebooks, and 1 lunchbox\n",
        firstInitial, middleInitial, number_of_pencils,
        number_of_notebooks);
printf("The total cost is $%.2f\n",
    number_of_pencils*pencils + number_of_notebooks*notebooks +
lunchbox);


return 0;

}

Since I don't know much about coding yet I haven't really tried a diverse ammount of functions, because I simply don't know and understand them yet.

The code works, so I'm happy about it. But I'm still wondering why it didn't for Dev-C++, which is the IDE I was planning to keep on using.

0

There are 0 best solutions below