User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
DaniWeb is a massive community of 370,565 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,990 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Showing results 1 to 40 of 461
Search took 0.04 seconds.
Posts Made By: Bench
Forum: C++ Feb 10th, 2008
Replies: 2
Views: 226
Posted By Bench
Re: Starting C++, any suggestions on compilers?

I assume you're after an IDE aswell, or do you intend to use a plain text editor (such as Notepad)? I also assume you're running Windows. If you're running linux, you're already equipped with...
Forum: C++ Feb 10th, 2008
Replies: 4
Views: 964
Posted By Bench
Re: Arranging 1D int. array in ascending order.

Assuming you're supposed to write your own, rather than use the standard C++ sort function, You'll need to implement a sort algorithm. a bubble sort or a selection sort should be fairly easy to...
Forum: C++ Feb 9th, 2008
Replies: 6
Views: 749
Posted By Bench
Re: Non dereferencable iterator C++

it would appear that your plist is empty at the point where your debugger has reached that portion of code.

You might prefer to use the deque::at() function, which is bounds checked, and throws an...
Forum: C++ Feb 9th, 2008
Replies: 6
Views: 749
Posted By Bench
Re: Non dereferencable iterator C++

In which case, the message may be telling you that you're attempting to de-reference the end() iterator (Which is actually 'one past the end'). To prevent the overflow problem, you might consider...
Forum: C++ Feb 9th, 2008
Replies: 6
Views: 749
Posted By Bench
Re: Non dereferencable iterator C++

The only problem I can see with your code is that eit2 will overflow, being one step in front of eit1 each time. I can't see anything which looks like it should give a compiler error. Could...
Forum: C++ Jan 8th, 2008
Replies: 3
Views: 640
Posted By Bench
Re: Memory leaks through stringstream.str()

The page appears to be over 10 years old, and the information probably older than that. Standard C++ does not have a class called ostrstream, and, to my knowledge, the standard C++ stringstream...
Forum: C++ Dec 24th, 2007
Replies: 3
Views: 339
Posted By Bench
Re: variables naming variables.

The alternative, using the <map> library, if you'd prefer to give the orders a 'Key' value identifier
#include <map>

/* ... */

std::map< std::string, order > the_orders;
order...
Forum: C++ Dec 20th, 2007
Replies: 13
Views: 1,138
Posted By Bench
Re: Timing Execution

I think he asked for 250 miliseconds didn't he? not 25?

Anyway, it shouldn't matter, because there's no guarantee that CLOCKS_PER_SEC is equal to 1000 (I believe on POSIX systems its defined as...
Forum: C++ Dec 19th, 2007
Replies: 14
Views: 1,411
Posted By Bench
Re: convert variable to ASCII number

main returns an int because the standard says it returns an int. if you omit the int return type from main then some compilers will complain and not compile at all, others might allow it to compile...
Forum: C++ Dec 18th, 2007
Replies: 10
Views: 560
Posted By Bench
Re: int * Help

I think he means 'Dynamic Memory Allocation' - I could be wrong though. Either way, it works fine with both char and int
Forum: C++ Dec 18th, 2007
Replies: 12
Views: 615
Posted By Bench
Re: What features would you like to add to /remove from C++?

If you were asked in another interview, which words would you remove from the English language, and why, how might you answer?

Then ask yourself what you think people who spoke the language would do...
Forum: C++ Dec 16th, 2007
Replies: 3
Views: 646
Posted By Bench
Re: Compare in templatized data structure

Additional:

It seems I was half-right, although, the STL uses the std::less<T> functor class as its default predicate for sorted containers, as found in the <functional> header. (std::less in...
Forum: C++ Dec 16th, 2007
Replies: 3
Views: 646
Posted By Bench
Re: Compare in templatized data structure

I could be mistaken, though I believe that the STL sorted containers expect a type with a valid operator<. If the type doesn't provide one, then overloaded constructor(s) will take an additional...
Forum: C++ Dec 15th, 2007
Replies: 12
Views: 628
Posted By Bench
Re: Templates -- Need major help please!!

The best tip I can think of with regard to writing templated code, is to write a non-template version first. Then you can be sure that your program is correct for one type (such as int), and that...
Forum: C++ Dec 8th, 2007
Replies: 2
Views: 1,336
Posted By Bench
Re: Capitalize first letter of word

If you're able to split each 'word' into separate strings, then you're already half way there

use the toupper function on the first character of that word, to generate the uppercase equivalent of...
Forum: C++ Dec 7th, 2007
Replies: 3
Views: 528
Posted By Bench
Re: Isspace counting

The >> operator skips over whitespace automatically.

One alternative could be to capture each line of input from the file individually as a string, using the getline function.
std::string...
Forum: C++ Dec 6th, 2007
Replies: 3
Views: 506
Posted By Bench
Re: Algorithms

There's no such thing as a "Best" sorting algorithm. Depending on the amount of data you're holding, and how ordered the data is to start with, one algorithm may be better than the other in...
Forum: C++ Nov 6th, 2007
Replies: 7
Views: 632
Posted By Bench
Re: Candidate Program

That appears to be almost every Computer Science student in the world these days - How fewer posts would this place get if students had 'more confidence'? ;)
Forum: C++ Sep 5th, 2007
Replies: 13
Views: 1,400
Posted By Bench
Re: Really need help with the interactive Calculator program, or will be dead

One thing I'd like to mention about the psuedocode comment - its unusual to specify data types in pseudocode - normally, details like that are left anonymous, concentrating on the high-level flow of...
Forum: C++ Sep 5th, 2007
Replies: 38
Views: 1,746
Posted By Bench
Re: passing arrays / updating object arrays

a[7] is an element in your array
(Also - if your array is only 7 elements in size, then valid elements are indexed 0-6, so you're accessing one-past-the-end.)

try this instead
pizza.set ( x , y ,...
Forum: C++ Sep 3rd, 2007
Replies: 8
Views: 1,182
Posted By Bench
Re: for rookie C++ (template) programmers

I understand your frustration.. there's still one or two pages in the book Modern C++ Design that frankly leave my head aching when I try to work out what the examples are actually doing

Yes, the...
Forum: C++ Sep 3rd, 2007
Replies: 8
Views: 1,182
Posted By Bench
Re: for rookie C++ (template) programmers

its a rather elaborate complicated example of template metaprogramming for a newbie IMHO. Try this as a simpler one :)

template<int N>
struct factorial
{
enum { value = N *...
Forum: C Sep 1st, 2007
Replies: 7
Views: 590
Posted By Bench
Re: Check windows passwords

Ah ok, sorry I misunderstood the original post - I thought you were after something that would allow reading the contents of the windows password files.
Forum: C++ Aug 31st, 2007
Replies: 5
Views: 1,133
Posted By Bench
Re: difference between pointers and handles

AFAIK the C and C++ languages don't define the term 'handle', so its use can vary according to context.

In addition to the usage as described in Hamrick's link, some texts use 'handle' to describe...
Forum: C Aug 30th, 2007
Replies: 7
Views: 590
Posted By Bench
Re: Check windows passwords

That would probably be a password cracker's dream come true. Seriously, do you really think there's going to be an easy way to access encrypted Windows passwords like that?

(I am aware of programs...
Forum: C++ Aug 29th, 2007
Replies: 7
Views: 743
Posted By Bench
Re: binary code

Representing integers as a binary number..? if not, would you be a bit more specific?

Here's one way, using a bitset
#include <iostream>
#include <bitset>

int main()
{
//bitset with 8 bits
...
Forum: C++ Aug 28th, 2007
Replies: 22
Views: 1,320
Posted By Bench
Re: school's back, and so am i :D

Yes that's right, but it assumes you're rotating about the origin :) Either way, the origin is a point, so, as hamrick said, you need two points in order to rotate something. :)
Forum: C Aug 27th, 2007
Replies: 16
Views: 821
Posted By Bench
Re: Displaying Average

There's no point having an array of one character..

and there's no point storing seperate variables for each grade, you could just do this (note the single-quote marks)
if (studentgrade > 90)
...
Forum: C++ Aug 27th, 2007
Replies: 18
Views: 986
Posted By Bench
Re: Help with Linked Lists

I think what you're seeing is a memory leak, the data isn't being deleted, its just being lost in the wilderness..

I assume that lst is the pointer to the head of your list (?), so don't modify that...
Forum: C++ Aug 27th, 2007
Replies: 16
Views: 1,726
Posted By Bench
Re: How to clear a string

Are you talking about C++ strings or C-style char arrays? (I assume you're talking about char arrays, based on your post)

What do you mean by "completely empty"?

You can make a C++ string blank by...
Forum: C++ Aug 27th, 2007
Replies: 15
Views: 1,556
Posted By Bench
Re: Dictionary Project

Here, you haven't asked the user to type in a word, so your string will be blank
Forum: C++ Aug 27th, 2007
Replies: 10
Views: 960
Posted By Bench
Re: Numbers

That depends, this isn't really a programming question, but more of a discrete/pure mathematics one - How comfortable are you with numbers in bases other than 10? - particularly binary (Base 2),...
Forum: C++ Aug 26th, 2007
Replies: 10
Views: 960
Posted By Bench
Re: Numbers

Maybe i'm unclear of the question.. but a number is just a number - you can use it to represent whatever you want. There's nothing particulary special about your 32 bit max value.. some systems...
Forum: C++ Aug 26th, 2007
Replies: 2
Views: 1,337
Posted By Bench
Re: How to create a notepad in c++?

You'll need to explore a graphical API to create the GUI - this will depend what platform you're running

(Or you could explore a cross-platform API such as wxWidgets http://www.wxwidgets.org/ )
Forum: C++ Aug 25th, 2007
Replies: 18
Views: 986
Posted By Bench
Re: Help with Linked Lists

Yes, it would be similar, except instead of looking for an element by checking its data, you'd be looking for an element based on its position. so you'll need a counter (A for-loop may be more...
Forum: C Aug 24th, 2007
Replies: 7
Views: 630
Posted By Bench
Re: Dear everyone, nice to be here. and a problem regard GTK

MingW is a popular windows compiler (for C and C++) - a windows port of the linux GCC tools.

have a look here http://www.mingw.org/

I have no idea whether it supports any of the GTK libraries...
Forum: C++ Aug 24th, 2007
Replies: 18
Views: 986
Posted By Bench
Re: Help with Linked Lists

your line number will be the position in the list, so you probably want to implement a function which will iterate through the list 'N' number of times to return a pointer to the element you want (or...
Forum: C++ Aug 23rd, 2007
Replies: 1
Views: 208
Posted By Bench
Re: Hi, I really really need help as easy as it seems

I assume the main function is that one called main() - which is the entry point of your program

If a variable is global, that means its declared outside of any functions. (the terms "local" and...
Forum: C++ Aug 23rd, 2007
Replies: 8
Views: 671
Posted By Bench
Re: c++ games ...

How about something like Hangman or Noughts & Crosses?
Forum: C++ Aug 23rd, 2007
Replies: 12
Views: 1,665
Posted By Bench
Re: Remove whitespace from all the elements in a vector

Why have you created your own isspace function? You'd be better off using the one declared in <cctype>
Showing results 1 to 40 of 461

 
All times are GMT -4. The time now is 4:37 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC