Beginners - April 2012 (Page 62)

.txt elements into an array
 
hi, I have a .txt file something like this: comics shona 91765 0 0 China name 97245 0 0 how can I input the first five elements in .txt fil...
[4 replies] Last: You could use a vector of strings to automatically dynamically allocat... (by Stewbond)
by Owain
Array of function pointers
 
Hello. For my program, I need to write an array of function pointers which return the same data type but have diffrent paramaters. My idea was to create a typed...
[1 reply] : Two ideas come to my mind: 1. Make the functions take a void pointe... (by kooth)
operator
 
What is the difference between return_type operator SYMBOL (argument) and return_type &operator SYMBOL (argument) and what makes ( & ) necessary for the...
[3 replies] Last: Frankly speaking, there only difference is that in first case you will... (by Beju)
Loop issues
 
This is homework, so please, NO CODE. If you can just tell me what areas to concentrate on fixing. I am to write a program that will ignore any negative int...
[11 replies] Last: Just wanted to say that I got this to work after the first negative nu... (by badkaykay)
by Beju
How to correctly cast pointer to integer in C++
 
Hi, I was just wondering if there's a C++ way to make unsigned integer from pointer to any type. The only way I found is the standard C-like cast. The system is...
[2 replies] Last: Thank you:) I thought that reinterpret_cast works only with pointers, ... (by Beju)
why wont anything display?
 
I am reading 2 .txt files into my constructor. Library::Library(ifstream& inbookfile, ifstream& incardfile) { //temporary variables string title, autho...
[6 replies] Last: Yeaaa, sorry about that, the .txt file actually doesn't contain "//isb... (by noonmoon)
How to use global variables in inline functions ?
 
Hi all, I have declared global variables in the main file. Then in other files where I need it, I refer to these variables with extern in the .cpp. But ...
[10 replies] Last: Thanks vlad. Wouldn't have been better for the compiler to have a homo... (by lalebarde)
copy constructor
 
class P { public: P() {} ~P() {} P(P const & p) { //<--- Question 1 setX(p.getX()); //<--- Question 2 se...
[8 replies] Last: C++ is just very strict about the type if you tell it that you will... (by Danishx83)
Create a program that checks whether or not a sentence is a palindrome
 
This is my simple program. However, I'm not getting correct results.. void main() { cout<<"Enter the sentence you want to check if it is palindrome or not"<<en...
[no replies]
How to approach problem
 
I'm given an array that holds information of flights origins and destinations, I am trying to write a program that determines the most efficient flight schedule...
[3 replies] Last: Dijkstra's Algorithm is based mainly around distance between nodes yes... (by Tikatee)
Random numbers: No repeats
 
I'm attempting to fill an array of size 200 with random numbers between 1 and 1000 but I can have no repeats, and the way I'm currently doing it gives me an inf...
[19 replies] Last: Thank you! Works now:) (by NerdTastic)
Little help with code.
 
Basically I'm trying to copy a file from one place to another but I want the user to be able to change were to because its for a steam game and everyone has a d...
[1 reply] : I guess that you could use $HOME ( %HOMEPATH% or %USERNAME% ) There is... (by ne555)
Could someone explain me what is Inline function and what does it do?
 
I was reading the C++ fAQ book and in chapter 9 the book starts talking about inline functions. The book says that inline functions are way to optimize your cod...
[4 replies] Last: Almost. The compiler would likely inline it to something like this as... (by Disch)
Is this an acceptable style?
 
From feedback I have received in the past, I have been trying to move away from having 'magic' values in my code. I tried doing this too with expressions as wel...
[2 replies] Last: Consider using an enum to specify the type of containment. It makes th... (by JLBorges)
Here's a dumb question for you
 
What's the point of "const char * whatever;" Or the point of char *'s at all really. Isn't a char just a pointer anyway, to the beginning of what may end up ...
[19 replies] Last: Got it, thank you very much! (by NerdTastic)
how to SQL Query a csv file in C++
 
I'm not sure if this is the right place to put but any advice is helpful. I'm trying to write a code to use SQL query statement to read a csv file in MSV...
[no replies]
Self-deleting pointer class
 
I'm trying to create suicidal pointer. This doesn't have any particular purpose, because it delete s pointer as soon as first pointer is out of scope, but I th...
[5 replies] Last: @vlad Yes that might fix the problem, however, I wanted both pointers ... (by closed account 10oTURfi)
Compile error with global variable.
 
Hello, I'm trying to declare a global map like this: // These work as they should ALLEGRO_DISPLAY *display = NULL; ALLEGRO_EVENT_QUEUE *event_queue = NULL...
[13 replies] Last: Happens :) Please mark the question as solved. (by TheDestroyer)
Guessing game
 
Hi everyone. I'm trying to make a guessing game or well I have made a guessing game between a human and a computer but the computer is very very dumb and it tak...
[10 replies] Last: Sure. I don't know if I'm the best to be learning from since I'm also ... (by doddolfur)
Best ways to do profiling??
 
What are the best ways to do profilling? I kind of new to the thing yet I've got an assignment requiring it and I don't really know where to start. So far I'v...
[1 reply] : What kind of profiling are you talking about? please be specific and e... (by TheDestroyer)
April 2012 Pages: 1... 6061626364... 66
  Archived months: [mar2012] [may2012]

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