Posts
 
Reputation
Joined
Last Seen
Ranked #560
Strength to Increase Rep
+6
Strength to Decrease Rep
-1
98% Quality Score
Upvotes Received
48
Posts with Upvotes
44
Upvoting Members
34
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
5 Commented Posts
5 Endorsements
Ranked #341
Ranked #383
~69.6K People Reached
PC Specs
Dell Inspiron 1525, Ubuntu GNOME 13.10
Favorite Tags

166 Posted Topics

Member Avatar for najiawad0

> Does anyone know if ubuntu is good for programming? It depends on what you're programming. For the most part, programming something in Linux is simpler than programming it in Windows, just because libraries are handled by a package manager rather than having to go through the tedious process of …

Member Avatar for NehaPande
0
734
Member Avatar for rfrapp

[quote]I really do like programming, it's just that the problem solving part is difficult for me.[/quote]I have devastating news for you. [quote]I forgot to mention that I'm relatively new to C++, and I have no idea what most of that means :p[/quote]Don't fret. I've been using C++ for five years …

Member Avatar for pty
0
1K
Member Avatar for najiawad0

> Should I get ubuntu on my mac? Is there a particular task that you want to accomplish on Ubuntu that you can't do on your current OS? It may not be worth the effort if you can do everything perfectly fine on your Mac as it is. > when …

Member Avatar for Violet_82
0
269
Member Avatar for yann.bohbot.9

Because you're essentially looking at the least significant bit first, you're printing them first, and as a result, the number is being printed backwards. A couple of notes here. The line `rem = rem%10` more than likely does not do anything because the line `rem=quotient%2` guarantees that `rem` will either …

Member Avatar for Banfa
0
146
Member Avatar for thomas_14

First code: You're calling `mainPage()` as if it belongs to the global scope. The way you've written your code, though, it actually belongs to your class `foo`. My best bet is, because of the context, it assumes you're declaring an implicitly-`int` function called `mainPage()` inside of both `minus()` and `add()`, …

Member Avatar for thomas_14
0
512
Member Avatar for mike_2000_17
Member Avatar for yogesh_6

You're erasing elements by position rather than by value. Once you start erasing values like that, you can't expect `v[number]` to be equal to `number` anymore. A better solution to this problem would be to have an array of `bool` keep track of which numbers can be prime, and which …

Member Avatar for Tumlee
0
189
Member Avatar for Seba Sama

You would make the fuction virtual, which allows you to override the behavior of a function when defining the child class. It should be as simple as changing `void set_dimensions()` as `virtual void set_dimensions()` in your `shape2D` class, and then rewriting `shape3D::set_dimensions()` to accept all three dimensions. There may also …

Member Avatar for Tumlee
0
352
Member Avatar for Labdabeta

I would recommend [icode]enum[/icode] in this case because that's exactly what they're there for.

Member Avatar for Ancient Dragon
0
1K
Member Avatar for hemanshurpatel

When you pipe two programs together via the shell, it actually just pumps the `stdout` of the program on the left into the `stdin` of the program on the right. There is no real need for calling `pipe()` inside your program in this case. For example, if I wrote the …

Member Avatar for Tumlee
0
713
Member Avatar for Pratique

main.c:7:6: error: 'i' undeclared (first use in this function) main.c:7:13: error: 'y' undeclared (first use in this function) main.c:9:3: error: 'x' undeclared (first use in this function) main.c:11:2: error: 't' undeclared (first use in this function)

Member Avatar for Mouche
0
349
Member Avatar for priyanka.choudhary.90038

Is there any particular reason you're using `for_each` when you already have C++11's range based `for` loops available? Is it part of an assignment that your `add()` function has to exist? The following would be easier. for(auto& i : vec) i += 2; for(auto i : vec) cout << i;

Member Avatar for richieking
0
256
Member Avatar for jonathan710

Another way to print the values pointed to by the vector is to use C++11's new range-based `for` loops (if you have an up-to-date compiler). This way, you don't even have to declare your own iterator. for(auto ptr : ptrList) cout << *ptr << endl;

Member Avatar for nullptr
0
262
Member Avatar for Tyler_1

> Is this memory efficient to split things up for developer "ease-of-use"? Even if it wasn't, it doesn't matter. Code maintainability and readability is a lot more important than shaving off a few bytes here and there. Your time as a developer is a worth more money than a few …

Member Avatar for Tumlee
0
318
Member Avatar for COKEDUDE

> That's quite a bit of difference, especially if there are thousands of nodes in the linked list. But don't compilers typically like to pad structs so that they are aligned a certain way (Like making the size a multiple of four)? Assuming an environment where `sizeof(int) == 4` and …

Member Avatar for deceptikon
0
945
Member Avatar for cambalinho

What exactly is Vvariant supposed to be? It's impossible to get the value of a `void*` (without typecasting it first), and it's dangerous to dereference a pointer that is `NULL`.

Member Avatar for cambalinho
0
127
Member Avatar for Learner010

You would be right. Arrays decay into pointers when you use them in a name context.

Member Avatar for richieking
0
190
Member Avatar for sahar.97

He means this sounds like a homework assignment, and we don't do those for people. You actually have to show some sort of an effort towards solving the problem.

Member Avatar for Tumlee
0
176
Member Avatar for VBOI

Because you're recursively calling `printtree()`, this means you're also calling `fopen()` over and over again. As a result, you're overwriting the file every time you print something to it. (The file handle is also not getting closed properly. I would suggest opening the file outside of `printtree()`, and modifying the …

Member Avatar for Nutster
0
3K
Member Avatar for VUEKID

You're using `strlen()` incorrectly. It doesn't take an `int`, it takes a `const char*`. The way you have your code written, it might be easier to simply count, one by one, how many characters there are by counting them as you print them, using `textLength` as a counter. if(file) { …

Member Avatar for VUEKID
0
181
Member Avatar for lehlohonolo.mohaila

You're spoonfeeding the answer to what is clearly a homework assignment to somebody who doesn't want to do any of the programming themselves. This is the reason so many people can get CS degrees without even knowing how to do FizzBuzz. I hope his professor is at least smart enough …

Member Avatar for happygeek
-1
392
Member Avatar for daino

NathanOliver: There is actually a `getline()` for `std::string` as well. `istream& getline (istream& is, string& str);`

Member Avatar for daino
0
220
Member Avatar for smdjilani

Are you doing this in an initialization context? Because if you do something like the following declaration: int *ptr = 12; It probably will not error, but instead make `ptr` point to the (probably invalid) memory location of 12. Otherwise, I'm absolutely baffled that no error occured.

Member Avatar for Ancient Dragon
0
171
Member Avatar for logicslab
Member Avatar for deceptikon
0
394
Member Avatar for Falcon143

As a general rule of thumb, if your program can be "optimized" by changing one little operator like that, then the compiler will likely do it for you. That being said, the short-circuiting behavior mentioned by deceptikon is important to note. Using the `&&` operator ensures that unnecessary checks are …

Member Avatar for Falcon143
0
183
Member Avatar for lalitha2294

Your usage of one-letter variable names, which are all declared at the very top of your `main()` function, has your program nearly impossible to read, let alone debug. You need to provide descriptive variable names if you want your stuff to be self explanatory. Do you seriously think it's good …

Member Avatar for lalitha2294
0
157
Member Avatar for Labdabeta

> PS: I see that a lot of people are already familiar with C++11 to the point that they don't think about it when they use its features. Is it now considered 'best practice' to use the new features? I am mainly concerned due to the lack of universal support …

Member Avatar for mike_2000_17
0
410
Member Avatar for 2384443

> At lines 33 and 38 your formal parameters are floats but you call the function using doubles - you can fix this by changing floats to doubles ( ex: 5.5 to 5.5f ) or simply change the parameter's type from the methods's header. Doubles are automatically converted to floats …

Member Avatar for richieking
0
141
Member Avatar for Abhinisha
Member Avatar for Abhinisha
0
199
Member Avatar for Kareem Klas

> The while statement is a loop that contininues to execute until some condition is met. I think you meant to say a while statement is a loop that continues to execute *while* some condition is met.

Member Avatar for Kareem Klas
0
334
Member Avatar for CodyOebel
Member Avatar for Suzie999
0
343
Member Avatar for christinetom

I personally use CMake myself for all of my projects. It's a really simple build system and it avoids all the boilerplate that you have to go through when writing a Makefile manually. If you're a FOSS purist, though, keep in mind that although CMake is open source software, it's …

Member Avatar for Tumlee
0
262
Member Avatar for nick.rechtien.5

What you would do is 1) Prompt them for the row number via `cin` (in the range of 1-3 if you're going for easy human interface, or 0-2 if you're lazy :P ) 2) Validate the input to make sure it's within the acceptable range, and repeat step 1 if …

Member Avatar for tinstaafl
0
515
Member Avatar for johans22

> In the main, I try to print the the elements of sArray1 using sArray. It doesn't work. I don't see you trying to print anything anywhere.

Member Avatar for johans22
0
123
Member Avatar for Na'Vi

> One is, is sizeof(char *) supposed to be size 8? It should be, provided you're writing a 64-bit application. > And also, when I look at the elements of list, list[0] is empty, list[1] and list[2] have something in it, and list[3] is invalid. We would have to actually …

Member Avatar for Ancient Dragon
0
336
Member Avatar for Stein102

Out of all of the IDEs I've tried, I prefer Code::Blocks the most because it's the most minimalist of the modern IDEs while still giving me the features I need in order to develop larger projects (being able to quickly find the delcaration of a variable or definition of a …

Member Avatar for Stefano Mtangoo
1
195
Member Avatar for Zevoxa

It depends on the operating system you're using. In Windows, the _mkdir() command does what you need. For Unix, see http://linux.die.net/man/2/mkdir .

Member Avatar for Zevoxa
0
112
Member Avatar for tyler.dahle

You can't just make your thunderball animation a `while` loop. When you have that loop going, no other code outside of that loop will execute, and this is likely the reason your character freezes on screen every time you shoot a bullet. If you want these things to happen simultaneously, …

Member Avatar for tyler.dahle
0
167
Member Avatar for owenransen

> Years ago I picked up the habit, I don't know where from, of always using > `#define NUL char(0)` > for 0 terminators in ASCII strings, and NULL for pointers. I wouldn't recommend that at all, and to be honest I don't see the point of using macros for …

Member Avatar for Tumlee
0
700
Member Avatar for mksakeesh

For some reason, I am able to run the first program without any issues whatsoever, which absolutely baffles me because looking at it, it probably *should* crash. You create a pointer called `pr1` which is *supposed to* point to a `linkedlistchain`, but you never initialize it nor set it to …

Member Avatar for mksakeesh
0
275
Member Avatar for AmrMohammed

> std namespace is defined inside the header Nope, that's not how it works. The `std` namespace isn't "defined" anywhere. All the `namespace std {...}` stuff is saying is that the stuff contained in the brackets *belongs* to the `std` namespace. > "deceptikon" I thought that header files are reside …

Member Avatar for Tumlee
0
259
Member Avatar for kent.johnstone_1

> Are struct names supposed to be defined somewhere else? Yes. When you declare a variable that is an instance of `usb_device_id`, you must first tell the compiler somewhere else what a `usb_device_id` *is*. If you have already written a declaration of this struct, we might have to see it …

Member Avatar for kent.johnstone_1
0
125
Member Avatar for Decode098

You're accessing your arrays incorrectly. When you have an array declared as `int num[2]`, `num[0]` is your first element and `num[1]` is your second element. You're passing values of `&num[1]` and `&num[2]` to the `scanf()` function. As a result, when you think you're entering your first number, you're actually entering …

Member Avatar for Decode098
0
135
Member Avatar for Xorlium

The problem is that by declaring a function in `Derived` that is the same name as the virtual function you declared in `Base`, you are actually *hiding* the original function that you declared in `Base`. These are little-known rules but they are rules nevertheless. When you have a function that …

Member Avatar for mike_2000_17
0
211
Member Avatar for billionair

C-style strings don't work like that. A variable of type `char*` is a pointer, and as such it actually has to point to a valid memory location before you can modify information in it. I advise against using `char*` with `cin` anyway because there isn't a guarantee that what you …

Member Avatar for rubberman
0
404
Member Avatar for murnesty

When used correctly, polymorphism is easily the most useful feature in all of C++. It's more particularly useful when you start getting into game design, where you often have large linked lists of actors, all belonging to different subclasses but all needing to behave differently from one another. In such …

Member Avatar for murnesty
0
159
Member Avatar for javauser1512

Although logically there should be a guarantee here that your function will reach a return statement, the java compiler doesn't seem to see it that way. I think there are two possible solutions: 1) Add an extra return statement that just returns some arbitrary value to appease the compiler. 2) …

Member Avatar for Starstreak
0
319
Member Avatar for Baldur

Usually, people just put the `main()` function in main.cpp (and sometimes a function or two that will only ever be used by `main()`), and leave other functions in other files. The place where you actually "flesh out" the function, as you put it, is called the "implementation" of the function …

Member Avatar for Tumlee
0
440
Member Avatar for Xheis

The syntax in this program you've written is completely wrong. It doesn't even appear to be real C code. What do you think the lines `letter [a-zA-Z]` and `digit[0-9]` do? What's with the two percent signs on the next line?

Member Avatar for Tumlee
0
882
Member Avatar for hckrwb

A function that prints something and then returns an integer is a bad example to try and understand the difference between a `void` function and a function that returns a value. Let's see if this clears things up, and please read the comments to understand what's going on here: #include …

Member Avatar for deceptikon
0
300

The End.