General C++ Programming - October 2009 (Page 6)

C style char arrays
 
If I read in characters into a char array using cin, why do I need a constructor for the char array?
[6 replies] Last: @compone87: I think the confusion is over your phrasing. You hav... (by jsmith)
Loading from a .csv file
 
I've done this before but I've gone brain dead / blank arghc! void LoadDataBase( std::vector<DBitem>& db, char* fileName ) { FILE* file = fopen(fileNam...
[7 replies] Last: If anyone wanted to see the solution : void LoadDataBase( std::v... (by Mythios)
binary file read problem
 
The file I am reading is a binary file. In that file the first I am reading names terminated by '\0'.Then I seekg to avoid reading the '\0'.When I use peek from...
[5 replies] Last: hi guys, You can input \0 in the binary file . I was able to read i... (by kai5gabriel)
by sporx
standard deviation and skew. due today
 
my program is almost complete, however i have two problems. im not quite sure if i did the standard deviation and skew formulas right. it works for most things ...
[3 replies] Last: yes, however i've never been taught vectors.. any help? (by sporx)
by nikman
vectors?
 
int loadCarts(string filename,SnackCart *&carts) { carts = new SnackCart; ifstream dataFile(filename.c_str()); int count = 0; string type; getlin...
[8 replies] Last: ok thanks :) (by nikman)
by NGen
Returning a Char Array
 
I know the process of returning a char array is simple, but returning an array without any memory leaks is a solution that seems to elude me. I'm creating a ...
[8 replies] Last: I see what you mean. Sorry, I was thinking about something else, but m... (by NGen)
by yygyt
"extern" problem
 
On Ubuntu, I am trying to compile a GL project consisting of 3 source files. One of them which has the main function in it has this code section extern vo...
[2 replies] Last: I knew it was a linking issue. I just didn't find how to link these fi... (by yygyt)
sizeof Explanation
 
Can someone please explain the behviour of this code #include <stdio.h> #define SIZE 10 void size(int arr ) { int b ; printf("size of array...
[8 replies] Last: Sorry, I meant (strlen(arr)) * sizeof(int*). I must have unconsciousl... (by helios)
Pointers
 
I have the following questions: For parts b-e, repeat the declaration and use the results from a. int x = 6, y = 5, *px, *py; a) Write 2 assignment...
[3 replies] Last: e) After executing *py = *px, are &x and *py equal? (I say yes. py no... (by JCED)
by JWP321
error regarding class
 
Hello, I'm receiving an error when I compile my code for "project06.triangle.cpp". How can i fix the problem without changing any code in the header file? He...
[4 replies] Last: ah, that makes more sense. thank you. (by JWP321)
Pointer Question
 
Hey guys, I have a question as to whether or not I am assigning the following correctly. The question states: Assume the declaration int m = 35, *intPt...
[1 reply] : It's correct. (by helios)
2-dimensional arrays
 
I'm trying to take a list of student id numbers along with a list of grades for each student for 5 quizes, store them into a 2-dimensional array, then output th...
[4 replies] Last: Thanks for posting a sarcastic comment when you obviously didn't even... (by cardinals03)
C++ program failing to rename a file
 
I have a C++ program running on Windows XP compiled with Visual C++ 6.0 containing the following code if (remove(NewName) != 0) { errmsg = strerror(errno)...
[1 reply] : Your doing something that the program can't account for and making it ... (by closed account S6k9GNh0)
by sporx
taking the median of an Array
 
solved!=]
[4 replies] Last: i tried just using the 2.0 and it gave me errors. ill try and make thi... (by sporx)
by alias
For Loop not continuing
 
I'm writing a code that counts numbers using a for loop. I'm stuck on the part of the code that has to count with null statements in the for loop. It counts out...
[1 reply] : for( ; ; ) is an infinite loop unless you have a break statement in... (by jsmith)
Resource Locking / Mutex
 
BgInfo: I am creating a MUD style game that is multi-threaded (under win32). Within it there is a large store of players that is serviced in multiple threads. O...
[9 replies] Last: Oh, now I understand what you mean. No, if you want to use my method y... (by helios)
ID3DXSprite vs a textured square
 
Can anyone tell me, is there any big difference between these two? Can I use effects with sprites? Can I render text to texture?(without rendering it to a spr...
[2 replies] Last: Indeed it is. I figured that many of those who know c++ may be familia... (by hamsterman)
Searching for class objects in memory.
 
Is it possible to search for instances of a class in memory by comparing the bytes that contain the classes functions? I tried using the string class, since...
[15 replies] Last: Just remove the static from the two variables. Neither needs to be st... (by jsmith)
Program Design issues
 
Can anyone please help me out. I'm barely 3 weeks into C++ and i have an assignment to design, develop a C++ program to calculate material properties of a gas s...
[no replies]
2 DIMENSIONAL ARRAY!!!
 
As of now my program as the user input an expression like *2x and then the program outputs it as * 2 x I am wanting to display zeros next to the elemen...
[6 replies] Last: thanks for all the advice. I was able to get it to output the zeros h... (by whitey300)
October 2009 Pages: 1... 45678... 17
  Archived months: [sep2009] [nov2009]

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