TwoOfDiamonds's Profile
Reputation: 38
Craftsman
- Group:
- Active Members
- Active Posts:
- 202 (0.68 per day)
- Joined:
- 27-July 12
- Profile Views:
- 2,598
- Last Active:
Mar 18 2013 09:11 AM- Currently:
- Offline
Previous Fields
- Country:
- RO
- OS Preference:
- Windows
- Favorite Browser:
- FireFox
- Favorite Processor:
- Intel
- Favorite Gaming Platform:
- PC
- Your Car:
- Who Cares
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: unable to open include file 'stdio.h'
Posted 5 Mar 2013
I don't think the symbols are the problem ... or at least they shouldn't since if you write <stdio.h> the compiler will look into the include directory of the compiler directly and if you use "stdio.h" it will first look into the folder of the program and if it doesn't find it there it will look in the compiler's include directory .
In my opinion, biggest chances are that there's something wrong with the compiler or the IDE settings
-
In Topic: C++ program to solve a soduku puzzule
Posted 1 Mar 2013
-
In Topic: Initializing a 2D array in a class
Posted 28 Feb 2013
jimblumberg, on 28 February 2013 - 08:06 PM, said:In future don't alter your previous posts to add or remove content, just post the changes.
My question is why did you create the default constructor at all? Since you don't have any other constructor, and you're not really doing anything with the one you created, let the compiler create the default constructor for you.
Jim
It was created automatically by the IDE and forgot to delete it, I know it has no purpose that's why I didn't add it in the first place ...
And thanks for the advice
-
In Topic: Count to a million
Posted 28 Feb 2013
12351.
Seriously large typo
/>
-
In Topic: Initializing a 2D array in a class
Posted 28 Feb 2013
baavgai, on 28 February 2013 - 03:04 PM, said:Now I have to ask. On what wonky compiler does this work?
[baavgai@DIC]$ cat a.cc #include <iostream> using namespace std; class level { public: level(); int arr[25][25] = {{4,6,4,21,5134,3}, {6, 4, 123, 543, 123, 13} , {5,23,65,1,2,3}, {1,2,4,0,0,2}, {543,23,234,124,12,45} }; protected: private: }; int main() { level Lvl; for (int i = 0 ; i < 5 ; i++) { for (int j = 0 ; j < 5; j++) { cout << Lvl.arr[i][j] << " " ; } cout << endl; } return 0; } [baavgai@DIC]$ g++ a.cc a.cc:10: error: a brace-enclosed initializer is not allowed here before ‘{’ token a.cc:14: error: ISO C++ forbids initialization of member ‘arr’ a.cc:14: error: making ‘arr’ static a.cc:14: error: invalid in-class initialization of static data member of non-integral type ‘int [25][25]’ a.cc: In function ‘int main()’: a.cc:29: error: ‘class level’ has no member named ‘arr’ [baavgai@DIC]$
That's what I'd expect. In C++, you can't normally have raw little initialization bits floating about in a class. That's what constructors are for.
I haven't copied the level.cpp file since it only had the constructor . Which I thought it's not important for the example. And it's Code::Blocks
I'll edit the first post and add level.cpp too
My Information
- Member Title:
- D.I.C Head
- Age:
- 18 years old
- Birthday:
- June 27, 1994
- Gender:
-
- Location:
- Ploiesti, Romania
- Full Name:
- Daniel Alexandru Radu
- Years Programming:
- 2
- Programming Languages:
- C, C++ , Java
Contact Information
- E-mail:
- Click here to e-mail me
- Facebook:
- http://www.facebook.com/radu.daniel.940
- Twitter:
- HakunaThePumba
Friends
|
|


Find Topics
Find Posts
View Reputation Given


|
Comments
TwoOfDiamonds
30 Aug 2012 - 23:23fromTheSprawl
30 Aug 2012 - 20:14TwoOfDiamonds
29 Aug 2012 - 00:39fromTheSprawl
28 Aug 2012 - 19:59TwoOfDiamonds
28 Aug 2012 - 01:46fromTheSprawl
28 Aug 2012 - 01:44