TECH C++ Question

nucklearknight

New Member
Sep 21, 2008
365
San Francisco, California
I'm slowly teaching myself C++ and I'm writing a little quiz program. However I have read somewhere that the codes
Code:
system("cls")

system("pause")

exit(0)
are inefficient. Why is that and what are alternatives?
 

CodeX

doesn't really matter if exit is inefficient lol.

system calls are cop-outs in my opinion... who writes console apps for DOS anymore though?

The real answer is... it doesn't matter. If you are using any of those functions your program is so trivial efficiency is of no concern.
 

CodeX

So learning C++ is a useless endeavor that I should give up on immediately?

No, I am just being cynical, while learning the language what you are doing is fine. I am just saying discussing it is rather trivial because the ONLY programs that use the dos prompt for IO anymore are ones written by students learning the language, like you.

Later, after you get a good grasp of C++ you can make normal windows applications if you so choose, complete with graphics and animations and buttons and menus and text fields and file open/save dialog boxes etc etc just like any other windows program.
 

CodeX

Read up on the windows API if you want to go with C++, its more difficult but more powerful. You can always use .NET in VB or C#, which is more like using a toolkit built by someone else, which is good for banging out fast generic apps.
 

quzer

Member
Nov 9, 2003
204
I'd recommend learning GUI in like Java or something, the Windows API is specific to windows, it won't work on a Mac or any UNIX based distro, however, I'm not saying that you shouldn't learn the Windows API at some point though.
 

CodeX

I would highly recommend against doing anything graphical in java. It is dog slow, it looks like shit unless you really get into customizing it, and what you will learn from it is mostly useless because it has an ass-backward way of doing everything.

I want to make this perfectly clear. I never suggested that you start writing graphical programs right now. If you are new to C++ the LAST thing you want to do is get mired down in API code. Learn the basics first, and using the DOS command prompt for IO is just fine while you are learning. When and if you want to learn Windows GUI the MSDN library is the most important thing you will ever read. I can also upload the source of some of my own programs, including a full featured MP3 player as well as the games found here: www.codextreme.net
 
Last edited by a moderator:

Users who are viewing this thread

About Us

  • Please do not post anything that violates any Local, State, Federal or International Laws. Your privacy is protected. You have the right to be forgotten. Site funded by advertising, link monetization and member support.
OT v15.8.1 Copyright © 2000-2022 Offtopic.com
Served by fu.offtopic.com

Online statistics

Members online
460
Guests online
59
Total visitors
519

Forum statistics

Threads
369,753
Messages
16,917,641
Members
86,875
Latest member
ddunn9448