Posts
 
Reputation
Joined
Last Seen
Ranked #153
Strength to Increase Rep
+11
Strength to Decrease Rep
-2
98% Quality Score
Upvotes Received
152
Posts with Upvotes
134
Upvoting Members
84
Downvotes Received
4
Posts with Downvotes
4
Downvoting Members
2
38 Commented Posts
~337.66K People Reached
About Me

Mathematical software developer

PC Specs
Windows 7 Visual Studio 2013
Favorite Tags
Member Avatar for rajesanthu

I think that you should probably think about indenting your code a little, so that the various blocks are a bit easier to pick out. Also, I think that it's generally best to have [icode]main()[/icode] return [icode]int[/icode] rather than [icode]void[/icode], that way you can check the return value of the …

Member Avatar for Youssef Faisal
-4
44K
Member Avatar for marsh_mallows11

You have mixed up the way your variables are used in your functions. For instance you call [icode]toOctal[/icode] on line 19 without any arguments, but [icode]toOctal[/icode] take a [icode]long int[/icode] argument and the way they are used in the function will give you an infinite loop! The function [icode]toHex[/icode] also …

Member Avatar for Lesther_1
0
10K
Member Avatar for mahdi2592

Hmm, what you have shown here are three *functions* or *methods* from a class. Two of the methods are used in the setup of your output (`setOutputStream` and `setMessageCallback`) and the other (`outputMessage`) is used to actually output the things that you want to output. You haven't given much code …

Member Avatar for ravenous
0
309
Member Avatar for dyingatmidnight

[QUOTE=Tomi1988;1532016]I don't know. What is the solution?[/QUOTE] The solution is to write your own arbitrary precision integer version, which isn't as complicated as it sounds.

Member Avatar for Jimmy_7
0
213
Member Avatar for usingnamespace

> i thought of the boolean route but i dont know how to implement it. I cant even get the Part 1 to work Think about what are the biggest and smallest numbers that have six digits, all valid pass codes must be between these two values, right :)

Member Avatar for ravenous
0
251
Member Avatar for khaled02

I reckon that you'll get rid of some of your compilation errors by correcting lines like this: if (head == NULL >> tail == NULL) I think that you just want something like: if ( ! head && ! tail )

Member Avatar for khaled02
0
238
Member Avatar for norEdz

OK, you're current program is not going to do what you want it to at all. If I were you, I'd start by looking at the question more carefully and breaking it down into a number of small parts. So, the question is: [quote]write a c++ program that given the …

Member Avatar for David W
0
11K
Member Avatar for Ahmed91za

Use std algorithms where possible: #include <string> #include <algorithm> // Store the password in a string std::string password; /* Do things to get password from user */ // Count the upper and lower case letters size_t upper_case_count = std::count_if( password.cbegin(), password.cend(), std::isupper ); size_t lower_case_count = std::count_if( password.cbegin(), password.cend(), std::islower …

Member Avatar for ravenous
0
292
Member Avatar for can-mohan

There is a school of thought that says that you should not really design your class such that you're having to actually do things that could fail in the constructor. You should instead "inject" the things that the class needs directly into the constructor, which should simply be a thing …

Member Avatar for can-mohan
0
386
Member Avatar for Learner010

> `for(int i=0;i<10;std::cout<<i++<<std::endl); Yikes! Don't write code like this :) In general, tricks in code made code unreadable in the long-term. I think it's a reasonably good rule that one should *never* write a loop unless if can't be avoided. I have a hierachy of things that one should try …

Member Avatar for Markland
7
691
Member Avatar for MrXortex

You can do it with a single array and a single value of the type in the array (an `int` in your case). Use the single value as a temporary to swap the first and last elements and then the second and penultimate elements and so on. Or, you could …

Member Avatar for tinstaafl
0
457
Member Avatar for can-mohan

I agree with the comments so far that you probably need to explain what it is that you're trying to acheive when writing this code. All these raw pointers are generally not necessary in modern C++. Further to what Decepticon said about your assignment operator, your programm `main` looks like …

Member Avatar for can-mohan
0
435
Member Avatar for daniel1977

You want it to "work better" how, exactly? Are you looking for general code standards tips, hints on using more C++-like paradigms? etc...

Member Avatar for ravenous
0
169
Member Avatar for tentrabyte

You can check for even numbers using the `%` operator on an `int`: int even = 2, odd = 5; std::cout << "even: " << even % 2 << " odd: " << odd % 2 << std::endl; any even number will return 0 when you do `% 2` to …

Member Avatar for tentrabyte
0
304
Member Avatar for johans22

I notice that you're making a vector of vectors of doubles. Are you planning to use this like a matrix to do algebra on and such? Or, are there other constriants (all the "rows" have to be the same length, or something)? If these things are true, then you might …

Member Avatar for ravenous
0
298
Member Avatar for obinaysamanoden

Even broken up into individual little programs, I don't think these will even compile. Probably best to get them compiling first and go from there. Efficiency is not your biggest issue right now. If you don't know how to do that, then ask questions about the errors that occur when …

Member Avatar for David W
0
277
Member Avatar for manofprogram

You can open any file and access the bytes in it. However, making sense of those bytes is much more difficult in the case of something like an mp3 or jpg file. You'll probably want to use an external library for that...

Member Avatar for ravenous
0
95
Member Avatar for Fenrir370

I think that you need another `for` loop inside the `count` function, which will go over the array of random numbers and count each value. You should also use more descriptive names for the arguments to the `count` function; so `x` and `n` should be something more like `values` and …

Member Avatar for Fenrir370
0
252
Member Avatar for khess

I think that you could do something like point 2 using Zero Install, or something similar. Although, I'm not sure that I want things auto uninstalling! Zero Install might allow a more dynamic installation of programs (as well as a more traditional model). In regard to point five, I think …

Member Avatar for rubberman
0
687
Member Avatar for Vasthor

Hmm, I'm not sure what your original question is asking exactly. I do have some comments on your snippet though. 1. If you use `QList` to hold stuff, then the `QList` is actually holding pointers to the stuff for you. So, if own the objects in the list, then you …

Member Avatar for mike_2000_17
0
351
Member Avatar for Vivek_12

Just a comment, but if you have an array of strings, you can iterate through them with one of the std algorithms to count the ones that you want. So, to count the number of "hello" strings, you can simply do: auto number_of_hellos = std::count( S.cbegin(), S.cend(), "hello" ); It's …

Member Avatar for Vivek_12
0
462
Member Avatar for nathan.pavlovsky

What compiler are you using? It might be helpful if you posted the error message that you're getting (or at least the first couple of errors that you get) :)

Member Avatar for mike_2000_17
0
8K
Member Avatar for softwaretime

You can't do this: tmm += ("Minutes: " + tmm); th += ("Hours: " + th); `tmm` is an `int`. What would it mean to increment and `int` with the sum of a character array and an `int`?. There are probably a bunch of other things wrong with this code …

Member Avatar for frank.dekievit.50
1
13K
Member Avatar for runningirl
Member Avatar for dereje mulie
0
87
Member Avatar for chubbyy.putto

have you tried adding some debugging output to your code? For example, print out the value of the indices and values that you're trying to swap in that inner if statement...

Member Avatar for chubbyy.putto
0
257
Member Avatar for priya.chitroda

You've definitely created logic of sorts for doing the tasks in the question, but the logic isn't *encapsulated* in any functions. The question definitely says that you should write *functions* to add data to the class room's attributes, etc. Also, you should avoid the use of `goto` in your code---you …

Member Avatar for james.opdyckeii
0
125
Member Avatar for Labdabeta

I would say: - Don't use the macro version - Use the const int version if you plan to use the variables in arithmetic (your intentions are clear to the reader this way), I.e. if the numerical value of the thing is actually important to you. - Use the enum …

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

I was basically really hungry for most of my early twenties. My housemates noted this and started calling me Ravenous. It seemed like a cool user name so I use it wherever I can. It's actually kind of common, so I also use Ravenacious (which I don't think is a …

Member Avatar for Reverend Jim
0
681
Member Avatar for triumphost

Does something like this do what you want? std::uint32_t Checksum = 0; std::uint32_t CheckSum2 = 0; std::uint8_t* Ptr = Pixels; int K = Width < 12 ? 1 : 12; for (int I = 0; I < K; ++I) //Start at 0 offset { for (int J = 0; J …

Member Avatar for triumphost
0
870
Member Avatar for rajesanthu

who can help me when i shut down my window ,it show a massage which tell us .(waiting for background programme to close ).any advice would be appreciated .Thx all friend It's probably best to start a new thread if your question is totally unrelated to this thread, which your …

Member Avatar for Monu_1
-4
10K