Welcome! Log In Create A New Profile

Advanced

PLEASE WOULD SOMEBODY HELP ME

Posted by thavaz 
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
PLEASE WOULD SOMEBODY HELP ME
February 18, 2009 11:56AM
Good day to you

I trust that you are keeping well.
Anyway, down to the problem. I am busy with my COS111U studies and have run into a major problem regarding the C++ software. I have completed many codes and have successfully run them as codes over the last month, but now I have all of a sudden hit an uncanny obstacle.
Everything is fine rite up to the time I create/insert a code and compile it. The problem arises when I click on run:
What happens is the program runs for literally a few split seconds (More like it quickly appears on the screen, then just as quickly disappears) and then vanishes. I do not get a chance to view what the product of the program looks like.
I have tried 2 solutions to try to fix this, one being selecting environment options from the tools menu and making sure that console menu remains open box is checked. This was to no avail.
The other solution was quite drastic, I re-installed windows and all my programs (including C++) and tried to get it to work. Also to no avail.
Without this being able to work I am in serious trouble.

I hope that you are able to assist me.
Kindest regards
Thavaz
avatar Re: PLEASE WOULD SOMEBODY HELP ME
February 18, 2009 01:01PM
Peruse the following thread .. perhaps you have the same problem -- > KKK
Re: PLEASE WOULD SOMEBODY HELP ME
March 25, 2009 01:43PM
Hi,

I would recommend the following:

1. Check that every souce file/program you save, does not contain a name where there are speaces or specialcharacters, it would save the file but when it comes to the
execution phase, it would do exactly as what you are experiencing now.

2. Check that the compiler settings are configured exactly as mentioned in the startup CD or user guide.

One or both of the above would rectify your issue.

Good luck!
Re: PLEASE WOULD SOMEBODY HELP ME
March 26, 2009 04:49PM
When I used Windows, I usually used a command-line box ("window"winking smiley to run my programs in. Once you're good at this method you can do it quickly and easily.

I know using a commandline (DOS-like) interface may seem like a step backwards, but (1) you'll always get your programs' output and (2) lot's of cool utilities like the 'ping' command are available through it once you learn how to use the command prompt (however this second point has got nothing to do with COS111U)

Firing up a command prompt window
Click on start
click on Run
type "cmd" (that stands for CoMmanD prompt) into the window that popped up and hit ENTER
a black command prompt window will pop up.

Using the command-prompt:
  • The command prompt will display your Current Working Directory on the left. It basically works by typing in a command and getting a response from that.
  • Typing "dir" (DIRectory listing) will list all the files and folders in the current working directory. Try "dir /b" for a more compact listing.
  • The command "cd" (Change Dir) will change your current working directory. "cd .." will take you 'up'. If I'm in a directory with a subdirectory (subfolder) with the name "work" and I type "cd work" and then "dir" I will see a list of the things inside this directory.
It's all very much the same as how you'd normally use windows, just a bit different smile

Example of how I'd do this
Create new program in DevCpp. I save it in the folder "C:\programs\" and name it "myprogram"
Type code
Drink coffee
Type more code
In DevCpp click on the Execute menu. Click on "Compile". Your program will be compiled but not run (yet)
Open up a command prompt (start > run > cmd)
type:
cd C:\programs
myprogram.exe
(now it should run. if it didn't work type "dir" and look for a file with an .exe extension and try typing its name)
Modify your program, compile it and again type 'myprogram.exe' in the command window.

I'd advise everyone who has a problem in this regard to try out this method.

[spoiler=Useseless cool trick]
Cool trick: type 'myprogram.exe > output.txt' and then when it is done 'notepad output.txt'
Now your program's output is in copy-and-paste friendly format. Unfortunately it makes it a bit hard to type in values as you can't see what the program is asking! spinning smiley sticking its tongue out
[/spoiler]


Completely different solution: (and I'd call this good practice) you should add a command that pauses the program at the end of your main() function (before 'return 0;'winking smiley. An example is 'system("pause" ) ; '
See this link: http://www.cplusplus.com/forum/beginner/1988/

PS. the quotes shouldn't be typed with every command. eg when I say "dir /b" type that without the quotes
Sorry, only registered users may post in this forum.

Click here to login