Thank you for the information.
>> I also assume that you cannot assign a value to an enumeration.
Sorry, i phrased that badly, i was thinking along the lines of mycolor = "value"; But i guess...
Type: Posts; User: Diablo84
Thank you for the information.
>> I also assume that you cannot assign a value to an enumeration.
Sorry, i phrased that badly, i was thinking along the lines of mycolor = "value"; But i guess...
Having had trouble understanding enumerations, i decided to have a brief trial and error session with my compiler to observe how they work.
enum colors {red,yellow,green,brown,blue,pink,black}...
Thank you everyone.
I am working on Windows XP (with Bloodshed Dev-C++ if that is relevant)
How do you set the title of the console window?
I have had a search but cannot find anything on it.
Thank you.
Thank you, i hadn't expected associative arrays... or maps, to be available so that's an added bonus.
Does C++ have a function similar to the PHP function, implode?
For example:
$var = implode('|',$thearray);
Which would join the array values together in a string with the | character...
Needless to say, anything like that is beyond me at the moment. I feel better knowing what's happening to cause the large file size.
I figure it makes more sense to question everything now rather...
For me it's simply a case of "out of interest", rather then it being an important issue. I couldn't understand why the executable was nearly half a meg in size when there was a relatively small...
Thank you
... and sorry, should have tried the search first :\
Hi,
As a learning curve i wrote a very simple console program. The compiled executable for this is about 460kb. It seems that anything from a few lines of code to 100 or more is still around 460kb...
Thank you all for the input, the use of strings in C++ is much clearer to me now.
The use of arrays wasn't a problem as my previous experience with PHP covered the theory side of things...
Thank you, using the array version for strings was a little inconvenient so it was quite relieving to find out there was a string type available in C++.
Is there any common occurrences when a char...
hi,
While working through various tutorials, the method of using strings in C++ has been to use an char type array, eg:
char mystring[10];
or
char mystring[] = "the string";
Thank you =)
I wasn't aware you could set a variable as type string, i had thought you could only use an array with char arr[n] in c++.
Hi,
I have just been rounding off learning the basics of working with C++ at the console level by coding a very simple game. Part of this entails opting to play the game again.
Basically, i if...
Thanks =)
Two simple things...
1. Is it important to include
return 0;
in int main()?
As i understand this tells the program that it has executed successfully however it doesn't seem necessary (in...
I have just been doing some reading on why it's advisable to avoid goto. Initially i got the impression that it was just taboo but for no specific reason. After digging a little deeper i found it's...
Thank you.
Could you confirm i have understood this line correctly from the FAQ:
if ( scanf ( "%d", &num ) != 1 )
The condition is that scanf did not successfully read one item and
I have been experimenting with basic number validation and i need a little advice...
#include <iostream>
using namespace std;
int main() {
int num;
Thank you 7stud, the behaviour of the code makes perfect sense now.
I can't tell you how useful an explanation like that is when you begin learning C++, thanks again.
Thank you both, very useful tip major_small.
Much appreciated.
Hi,
In the past few C++ examples i have worked through i have used cin.get() to wait for the enter key to be hit before the console window is closed (so code output can actually be observed before...
Thank you for the information 7stud, that explains the behaviour of my original code.
On the bright side, a mistake made leads to a lesson learned.