General C++ Programming - March 2015 (Page 6)

value-returning functions
 
For some reason this does not return the average of the three grades please help me figure out why its not returning the correct value. #include <iostream>...
[2 replies] Last: Thanks for your help. (by kdriver04)
Passing value from function to another function
 
Hi i have these 2 functions.. function1() and function2()
[3 replies] Last: @TarikNeaj yeah i did notice :D thanks okay2, ill watch it (by tonitones)
One Object for two functions
 
Hi, I need to know if it is possible/not possible to share one object for two functions.. o.o
[13 replies] Last: Glad I could help :) And thanks for using code tags :DD (by TarikNeaj)
"Skipping" Cin?
 
Hello, my code here seems to be skipping my cin statement. Currently I compile with g++ then use ./a.out < file.txt to execute then it should take input from t...
[5 replies] Last: That would be different for each terminal/shell though, and what about... (by LB)
OPENING A TEXT FILE
 
We have been assigned a task where we have to open a text file but we do not know how to do it. Does anyone know how??
[16 replies] Last: @softwaretime No. That is .Net and CLI. It'd look like this: StreamR... (by coder777)
by deu439
Allocation of base member from derived class
 
Hello, I'm working on implementation of container class to hold image data. What I want is to create a base class pixelContainer which contains a pointer to ...
[4 replies] Last: Well it seems to me quite useful to let the most specific class manage... (by deu439)
For loop with fstream help!
 
I have a for loop that compares the input and a specific line on a text file if they are the same. This is for the log in of my program. But there is something ...
[1 reply] : Suppose it can't find the username and password in account .txt. The ... (by dhayden)
Searching in a file...pls help Urgent! Arun Antony are you there?
 
User first inputs records into file "gamers.txt". Now i want a search function to input number to be searched from the user and match it with the a record (sear...
[4 replies] Last: void main() --- int main() (by TarikNeaj)
getting a error code whats wrong?
 
I keep getting this error code It builds the code but when i run it, it just crashes it says "the stack around the variable 'names' was corrupted. #include ...
[1 reply] : Please use code tags: [co de] Your code [/co de] Read this: http://w... (by coder777)
by yj1214
What does __stdcall and __cdecl do?
 
I'm learning how to make dll and lib files using c++ and I see lots of codes that looks like this, void __stdcall Foo(); void __cdecl Ham(); Wh...
[1 reply] : __stdcall and __cdecl are "calling conventions" When you call a funct... (by Disch)
by mmess
How to read from a file with varying amount and multiple data types in each line c++
 
Following is the file : ( The first line shows the number of Students in the file ) These are Names followed by marks in different subjects. 15 Albert Einste...
[3 replies] Last: - Read each token into a string - Try to read that string as a number ... (by LB)
Creating a DVD menu for a library system
 
Hi guys, I am in the process of creating a library system. I am creating a Dvd menu now and this how it looks right now: switch (dvdOption){ ...
[1 reply] : I suppose searchDVD function return a reference so then you could do a... (by Aceix)
Help with C++/SFML
 
I am currently working on adding collision between a Sprite controlled by the player, and the walls of my tile map. At the moment the player can walk on any til...
[1 reply] : One technique is to check if the sprites of the various entities inter... (by Aceix)
by Micard
Linked Lists: deleting an element
 
Hey, could you please correct this code for me? I tried like tens of different ways to re-write it and it either doesn't work or gives me a memory-leak error. ...
[6 replies] Last: doug4 , yep. Got it rolling. Thank you! ats15 , thanks to you too!... (by Micard)
Mode Function
 
Hey guys, I'm having a bit of a problem with figuring out how to properly write up a process to calculate the mode of an array of numbers. Criteria of project:...
[2 replies] Last: Unfortunately, I have yet to learn how to use the std::map in my class... (by ivertony)
by yj1214
Does g++ support strongly typed enums?
 
I'm using g++ with -std=c++11 flag. For some reason, I get an error whenever I use enum class. #include <iostream> using namespace std; enum cl...
[3 replies] Last: Strongly typed enums should be supported unless your version of g++ is... (by Peter87)
by AG123
Using bubble sort to sort a vector
 
I am trying to use bubble sort to sort a vector of permutations. I was wondering if someone could help me find my error in program because it incorrectly sorts ...
[1 reply] : Btw, I know you didint do that function, you just copy pasted it - htt... (by TarikNeaj)
by poteto
What is "void (*)()", and what is good or bad about it?
 
I just found this out from randomly porting some C code to C++, it seems to be some kind of polymorphism but only with functions, it's kinda crazy to me. I thou...
[11 replies] Last: ++ for <functional> and std::function. Pointer-to-member syntax doesn'... (by S G H)
C++ Template object composition - How to initialize correctly? (1,2)
 
Hi guys! This is my first time here, and i really need help! I'm posting this because i'm having trobules in creating new data structures.. it may look w...
[35 replies] Last: It would be great!!! However i mark this as solved, maybe we can talk ... (by EleKtroFR)
by bw119
Constructors question
 
So i have this code double data; cout << "Input data" << endl; cin >> data; Area(data); Area is a class with a constructor that takes a double as a parame...
[4 replies] Last: Thank you MiiNiPaa, that explains a lot. I changed my code according t... (by bw119)
March 2015 Pages: 1... 45678... 28
  Archived months: [feb2015] [apr2015]

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