General C++ Programming - February 2013 (Page 7)

by cob
Program crashes... cin.get() not... cin.getting
 
It's a simple dictionary, to work with pointer arrays a little. The program is supposed to tell the user when the word entered isnt in the database. Instead, th...
[4 replies] Last: ahh... so then limiting the size is a separate task altogether! I must... (by cob)
Managed memory, what do I return?
 
I'm using std::shared_ptr to manage my memory, but I'm no longer sure what to return, I don't like any of the options I know of (shared_ptr, weak_ptr, pointer, ...
[no replies]
Template for a Stack?
 
Ok, Im editing this post.. I got a template to work, just confused as to the isFull and isEmpty functions..can someone explains how/ why this works. To me, it ...
[6 replies] Last: Your absolutely right.. I just realized I was using () instead of [ ] ... (by jjroyale)
Dynamically allocated array help
 
I am having some trouble on understanding how to create a dynamically allocated array and then inputting some information in to it from a text file. Any help...
[1 reply] : char *array; array = new char ; (by Smac89)
Conversion from Pdf to text file
 
Hi, I have this project for my college work but i'm not getting any single idea and with that I'm a newbie to C++. How do I ever Convert a .Pdf file to .txt fi...
[5 replies] Last: That code was compiling but the output i got was a blank text file. Wh... (by points2008)
Random number generator problems
 
I am working on a console version of the dice game pig. So there are two players, the computer and you. You either choose to roll a random number or hold. If yo...
[6 replies] Last: The part of the code that alters continuePlay is only performed once... (by noobletplusplus)
Unsigned int or size_t?
 
Hi, I know that to run a for loop we can use int to control like for(int i=0; i<x; i++) . But when x is a size function we have to use size_t type like for...
[8 replies] Last: All objects created on the stack are destructed at the end of their sc... (by LB)
Function Overloading
 
Hello we got the following assignment:  Declare a member function speak() for each of the class with different implementation such as cout <<”A dog spea...
[3 replies] Last: class Dog { public: string name; public: void speak() const { ... (by vlad from moscow)
Function pointers vs subclasses
 
Hi Guys, I am in a position to choose between function pointers and subclassed objects. To make it clear, say I have to notify some object of some action (a ...
[6 replies] Last: Are there C++ libraries that aren't templated on callback type? Even A... (by Cubbi)
Threading Static Templated Member Function In Template Class
 
I'm kinda stuck on this. #include <iostream> #include <thread> template <int A> struct X { template <int B> static void function() { std...
[no replies]
RandomRiddle
 
I have started writing a c++ code in which I must keep the program alive until the user ends it. I must also use a sturct, a vector, strings and a random genera...
[1 reply] : Uhh, what next? Well you said you need vector and random, put them i... (by yelnatz)
by rajiv1
Error LNK 2019 with VS 2005
 
My humble greetings to everyone. First of all, I would like to present myself. I am a student and I am relatively new to the field of programming. I am trying...
[no replies]
Reading text file
 
I'm trying to arrange names alphabetically from a textfile. Inside my textfile, it's like : "John", "Edward", "Peaches", "Anna"... etc.(It has thousand more nam...
[2 replies] Last: Woah, thank you so much! :))) (by polkodot)
Can you help me ???
 
This code is show all the composite numbers1 to 100. how can i add a limit of 5 column in this sample program?? SAMPLE OUTPUT! 4 6 8 9 10 12 1...
[1 reply] : Just use a counter in there. if( (count++ % 5) == 0 ) cout << endl;... (by yelnatz)
Variadic Templates
 
I'm looking for a way to enter an unlimited amount of types in the <> part of a template function, I found Variadic templates but I'm not sure if it can do it, ...
[2 replies] Last: Thanks :] (by Zephilinox)
Can someone help with O(N^2) questions, shed some light on them.
 
I need help with these, and don't quite understand. Can someone please help shed some light. 1) Assume an algorithm is O(N2) and it takes it 40 seconds to ...
[8 replies] Last: For 1, I don't think it wouldn't take half the time, it would take a q... (by Zephilinox)
Basic question but need a solution
 
Hi, I have to create and use a lot of vectors like vector<double> vage_1; vector<double> vage_2; vector<double> vage_3; ...... I know we cannot use for ...
[2 replies] Last: Create an array of vectors, use the subscript to access the vector you... (by TheIdeasMan)
Time complexity in STL
 
while adding ,removing and updating (at first/last/in between) data in vector, list or in simple array, what is the time complexity?
[2 replies] Last: Linked list: O(1) -> No defference for first, last or between For "b... (by Peter87)
game of life
 
#include<iostream> #include<cstring> #include <iomanip> #include <cstdlib> //dear all i dont know how to return array can pls help me. using namespace std;...
[no replies]
Retrieve from Hash Table HELP!
 
Hey guys, I'm trying to retrieve the Player object from my hash table so I can edit the content of that object. Here is what I have. Player* HashTable::...
[3 replies] Last: This is more a data structures issue than a C++ coding issue. Once yo... (by kbw)
February 2013 Pages: 1... 56789... 43
  Archived months: [jan2013] [mar2013]

This is an archived page. To post a new message, go to the current page.