Welcome! Log In Create A New Profile

Advanced

DEV C++ V4.9.9.2

Posted by Epeachey 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
DEV C++ V4.9.9.2
March 17, 2010 07:07AM
HI

for anyone using the Dev C++ Version 4.9.9.2 you can use the following format to let your program compile and run:

#include <iostream>
using namespace std;
int main ()
{
int F;
cout << "enter tempreture in degrees farenheit: " << endl;
cin >> F;
cout << "that is: " << 5*(F-32)/9 << " in Degrees Celcius" << endl;
cin.get ();
getchar ();
return 0;

}

you do not need to put in cin.get ();
if you dont have an input.
but for me the program doesnt appear, it flashes and doesnt work unless i have this exact way of doing it.
I followed the tut letter to the last word but just with the latest version of dev C++.
in the tut letter there is a way to fix the flashing console screen but it doesnt work on the latest version of dev C++.
avatar Re: DEV C++ V4.9.9.2
March 17, 2010 08:29AM
This is an issue which pops up every year that unfortunately the younger students just don't get, primarily because they grew up on Windows.

There are two types of applications that you can create, a console application and a GUI application. If you grew up with Windows or MAC or something similar with windows and buttons, etc. , you'll all be familiar with the GUI apps. The console apps are a much older invention and are usually only used these days for background programs or administrator tools. They are controlled though a text-based console window. In Windows, you access the console by clicking on START -> Run, and then typing "cmd".

All the applications you will create in COS111, COS112, and unless changed COS211 will be console apps. This is because you still need to learn the basics of programming and GUI apps are a lot more complicated when compared to console apps.

GUI apps run an infinite loop to collect event messages from the operating system while console apps just run from start to finish. Once the main() function is exited, all applications close down.

In Windows, if you run a console app by typing in the program name at the command console (ie by running "cmd"winking smiley, control will be passed to your app and when it exits, you'll be dropped back into the command console. If you run a console app by double-clicking on it's icon like any other application, Windows will create a console session, run you app inside it and then close the console when your app finishes. If you app runs extremely fast and exits very soon after it's started, you'll barely be able to see what's going on because Windows will have closed the console window before you can read anything. This is the "flashing" every first-year experiences.

There are three ways to make the flashing stop:
1. If you are creating you program from inside an IDE, the IDE itself will usually have an option to allow the window to stay open after the app has exited. I've found by observing others complaints that various IDEs don't seem to support this very well, or else it's hidden away somewhere that beginners can't seem to find it or they don't read the instructions completely.

2. You could add extra code to the end of your program to effectively pause your app. As far as I remember, the lecturers don't mind if you do this but just confirm (send an email to cos111@osprey.unisa.ac.za), they might have changed their minds.

Language: C++
int main(int argc, char **argv) {   // Your application-specific code goes in here     // pause the application to prevent immediate exit back to the console cout << "Press enter to exit ..." << endl; int dummyInt; cin >> dummyInt;   return 0; }

3. You could execute your app the way it was designed, from the console itself. If you open a console window by running "cmd", navigate to your application and execute it, when it exits, you'll be returned to the command prompt. The console window won't close down.

I know this reply doesn't answer your question directly but I hope you can use the information I've given.
Sorry, only registered users may post in this forum.

Click here to login