Forceflow said:Grrrrrr
Can't help it matt, but its pick.
Sorry. :smile:
OtZman said:There's nothing wrong with the code in itself, it's just that console apps shut down as soon as you're finished.
Now I've downloaded Dev-C++ and it seems to work fine and I've compiled my first program ever!!! :biggrin: The only problem is that when I try to run the program it is closed after 1/2 seconds or less...
This is the code I'm using:
#include <iostream>
using namespace std;
int main()
{
cout << "My first program ";
return 0;
}
Anyone with any ideas? What can be wrong?
Crono said:Because that's what everyone who does "Hello World" does...besides it can get annoying having to go back and grab specific components out of an object when you realized you just needed. Now when you release to the public...yeah, you'd better be getting only the things you need :wink:
One more thing, is there in particular reason why you think you need a namespace for this program? lol
DesPlesda said:I second that. There's no real reason for a learner to be learning C++. Make sure you understand Procedure oriented programming before you shift to OO. And don't believe all the cooks out there who scream about C being outdated and C++ being "b3s+ 3v4r!!!" and all that. C++ is probably only good for very, very large applications which lose coherence with structured languages.
Oztman, I wouldn't recommend learning C++ first. Learn C, as it's simpler (and in my opinion better) so that you understand the basics of imperative programming before you start on object-oriented coding.
Crono said:Er, doesn't that beat the whole purpose of C++? I'm not disputing the validity of what you said. Just the purpose :razz: . What use is C++ when C generates more efficient code in the Procedure oriented way?
C++ is actually perfect for procedure programming, it just depends on what book you have!
Edge Damodred said:The batch file method worked, but than some other lines also were printed on the screen like "C:\\Dev-cpp\\[code]\\>pause". The other method with the cin statement didn't work...
There's nothing wrong with the code in itself, it's just that console apps shut down as soon as you're finished.
You can write a batch file with the following lines
*****.exe (name of the executable)
pause
rename the text file to .bat and run it from there. Some compilers will do this for you when you run in debug mode, but not all.
That should work for you though. You could also put some kind of input statement at the end.
cout<<"Input q to quit."
char q;
cin>>q;
but that just looks bad, so go with the .bat method.
OtZman said:How to make those appear on purpose or on accident.
I've never heard of a loop before. I'm totally new to programming, but I thing I start to understand what a loop is, but I don't get how to make letters like ?, ?, ? to appear on my screen
Edge Damodred said:Wow, thx Edge Damodred, now I can make ?, ? and ? and whatever I want! :biggrin: Thx a lot!! :smile:
but yeah, to see if it's in ASCII, use the for loop and modify the output statement slightly to see the corresponding numbers
cout<<"\\n"<<(char) i <<'\\t'<< i;
Oh, for single characters and escape sequences(anything that starts with \\), you can just use a single quote.
To print out the character '', you'll have to do '\\' to get the compiler to shut up about illegal escape sequences and stuff, even when you send in directory strings as well.
Edge Damodred said:I just noticed that the numbers in the ASCII chart didn't represent the right letters correctly. Is there a way to adjust them so they do?
How to make those appear on purpose or on accident.
On accident it's just random chode(garbage) that was picked up in the memory that that was grabbed and it interprets it as characters.
but yeah, to see if it's in ASCII, use the for loop and modify the output statement slightly to see the corresponding numbers
It's totally illogical. The numbers seem to have nothing to do with the letters. I also checked http://www.asciitable.com and it was the same thing there. Totally illogical.