General C++ Programming - February 2014 (Page 17)

Class Person
 
Implement a class Person with two fields name and age, and a class Car with three fields: The model A pointer to the owner (a Person*) A pointe...
[7 replies] Last: Also for POD(Plain-old-data) types most people use structs. (by giblit)
Save data
 
Can any C++ or C program save input data?
[3 replies] Last: #include <iostream> #include <fstream> int main() { std::ofstream f... (by Stewbond)
Returning short int arr in a function
 
I'm trying to return a short int in a function This is my function signature : short int* StartRecord(int seconds) this is my array : short int...
[1 reply] : Arrays cannot be copied, so you cannot return them from a function. Y... (by Disch)
Binary Search Tree remove() function
 
Im working on a BST remove function. I think I'm on the right track but I'm not sure. From what I understand there are 3 possible cases. A Node with no children...
[4 replies] Last: You are not freeing memory as you should, removing link to a node does... (by Smac89)
Infinite Loop PLEASE HELP
 
I am getting an infinite loop when my program generates a new bracket #include <iostream> #include <string> #include <stdlib.h> #include <numeric> #inclu...
[2 replies] Last: That was it! thank I forgot to put a stopping condition and that for()... (by lethal71)
How to open a help file using C++ CLI program - To help others
 
This is my give back to this awesome forum with your help I managed to create a function which will open a help file from the current directory the exe is in. I...
[no replies]
Checking to see if integer is a character.
 
#include <iostream> using namespace std; int main() { int x; cout << "Enter character:"; cin >> x; if(char(x)=='+') { cout << "This is addition"; ...
[5 replies] Last: The slightly tricky part is that +6 is valid input of a number. Per... (by JLBorges)
help-garbage
 
Hello. I am using a library which seemingly doesn't reclaim memory automatically, and thus I get memory allocation errors from some point on in my program. I t...
[2 replies] Last: there is no garbage collection in C++. If the library allocates memory... (by codewalker)
by whilom
Infix Calculator
 
Trying to make an infix calculator but can't figure out what is wrong with this code. Thanks in advance for help. #include <iostream> #include <cstd...
[5 replies] Last: Tried it already but it still gets an error. Cannot figure out why tho... (by whilom)
by ZTM
I need help with my program
 
this is the program code // main.cpp #include <iostream> #include <iomanip> #include "facultyType.h" using namespace std; int main() { cout<<...
[2 replies] Last: I need help with my program this is the program code If you read th... (by kbw)
When to upload projects to Github?
 
I'm interested in improving my programming skills so I can get a programming job. I majored in a STEM subject as an undergrad (not CS) and used C++ for a resea...
[1 reply] : Can you move this to the Lounge please. Clearly the more you can demo... (by kbw)
Rogue-Like game problems
 
Hey everyone! I've been trying to make a rogue-like game with C++ and Windows API, no other libraries such as Curses. I'm trying to do this so I can understa...
[1 reply] : Please don't post the same message to multiple forums. Follow-ups sho... (by cire)
float vs integer
 
An integer is 4 bytes on a 32-bit computer. A float is 4 bytes on a 32-bit computer. But a float is required to store more digits than an integer. A float needs...
[2 replies] Last: An unsigned integer can store any whole number between 0 and 429496729... (by Stewbond)
I can't figure out how to make this more efficient!
 
I'm supposed to make the most efficient function to win this game. Only the main.cpp can be edited. I've included all of the needed code. In the main.cpp, I've ...
[1 reply] : Welcome to the forum. If you want our help, start by helping us help y... (by xismn)
I am having trouble finding the GCD of n numbers
 
I know how to write the GCD for one, two, three, four, and etc, numbers. But I cannot seem to find a way to write a code that does it for 'n' numbers. That is,...
[1 reply] : bool i_can_divide_them_all( int number, int *array, int size ){ fo... (by ne555)
C++11 multi-threading basics
 
I am trying to better understand how to implement threads in C++. Suppose for instance I wanted to create 2 threads that do [insert anything] and I wanted to...
[7 replies] Last: > I want to output the number of times I called that thread to perfor... (by JLBorges)
Pointers/Link List
 
I am having trouble with the insert function of this project, we are to use pointers to insert a dash and middle initial into the name where there is a dash. I ...
[no replies]
free() a char* once it's been cycled through.
 
If I _strdup() a char*, and they start cycling through it's pointers, how do I free() it at the end? Example: char *orig = _strdup(my.GetData("creature...
[4 replies] Last: Yes, thank you. That's much more efficient. Tested successfully. ... (by xwielder)
Input 3 vectors. Error codes: C2059, C2334, C2628 & C3874,
 
Hi Guys, I'm working on fixing a program as part of my C++ Course. I have been trying for 4 days now and I'm getting no where. As soon as I change something I g...
[4 replies] Last: You have a trailing ; after the constructor's parameter list. You also... (by firedraco)
Question about structures and pointers
 
so, guys, I have a question. here's the code: #include <iostream> using namespace std; struct character { int age; char gender; char *name; };...
[12 replies] Last: thanks, guys :) thank you bufige for showing me how to do it. thank al... (by chippzanuff93)
February 2014 Pages: 1... 1516171819... 33
  Archived months: [jan2014] [mar2014]

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