Posts
 
Reputation
Joined
Last Seen
Ranked #557
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
~68.8K People Reached
PC Specs
Dell Inspiron 1525, Ubuntu GNOME 13.10
Favorite Tags
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
723
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
266
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
143
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
507
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
186
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
350
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
698
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
346
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
254
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
258
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
316
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
939
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
124
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
189
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
174
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
177
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
388
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
216
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
169
Member Avatar for logicslab
Member Avatar for deceptikon
0
390
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
175
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
155
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
408
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
140
Member Avatar for Abhinisha
Member Avatar for Abhinisha
0
194
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
330