General C++ Programming - April 2016 (Page 7)

Need some help removing the space at the end of my output.
 
Can't seem to find a way to get rid of the space at the end of my code. Help! Code is as follows: #include<iostream> #include<string> #include<sstream> #includ...
[no replies]
by Tia
Calculate sum, product, power using recursions
 
Someone can explain how to think these type of recursion. In this exercise isn't allowed to use arithmetic operators but only recursion. I don't understand how ...
[2 replies] Last: Thank you so much. Clear explanation. (by Tia)
implement queue using vector
 
How can I implement queue using vector. Also What does this mean vector <int> queue
[1 reply] : push : push to the back of the queue (vector - push_back ) pop : po... (by JLBorges)
Reading into a struct
 
I'm supposed to write a reading function for a PPM file that saves the r g b content to a vector vector of the pixel. Can anyone help me fix this function? Line...
[1 reply] : while(infile >> r >> g >> b) { Pixel::Pixel(int r, int g, int b)... (by Thomas1965)
Iterate through strings
 
Hi, If I has a series of strings with names such as: string1 string2 string3 string4...etc How would I create a for loop to interate throu...
[3 replies] Last: So, I guess I could put them in an array also. But don't. Arrays are... (by Moschops)
Memory Leak when combining char arrays
 
I have a function to combine two char arrays but it results in a memory leak. const char* combine(const char* first,const char* second) { char* buffer...
[3 replies] Last: It only results in a memory leak, if your calling code doesn't delete ... (by MikeyBoy)
by jpaz
Class HELP!
 
Hi, i am new at programming and i am working in a hw were i need 3 files. I need one file.h, file.cpp, fileMain.cpp . I need to find the average of some grades...
[3 replies] Last: Hi, Generally the file.h shows the function prototypes (names and para... (by ShaLee)
recursion string error, why this is happening
 
#include <iostream> #include <string> #include <cstdlib> using namespace std; bool isPal(string); int main() { string name; while (true) { ...
[2 replies] Last: 1) Please use code tags when posting code, to make it readable: http... (by MikeyBoy)
How to Format a Calendar Program
 
I'm having some trouble with my Calendar program. Everything for the most part is working correctly, except I'm not sure how to make it so the calendar isn't so...
[7 replies] Last: I got it! I tried using setw() earlier but I was adding it in the wr... (by raiiiny)
linked list help
 
I have this project to input 12 numbers each into two linked list and sort them. Then with the first list i have to take the average and delete all numbers > th...
[1 reply] : First: Please use code tags: [co de] Your code [/co de] Read this: ... (by coder777)
Print the number of even and odd numbers
 
Hello I want my program to count the number of even and odd numbers inputed by the user, but it does not work. I want them to be able to input more than one int...
[2 replies] Last: I got it to work thank you for your help. (by bluewizzard)
debug lists in gdb
 
Hi there! I am working with a list l from the STL. In gdb, if I call 'l.front()' I get this message: Cannot evaluate function -- may be inlined ...
[9 replies] Last: Hi JLBorges I already tried printing the list in a readable form. But... (by hebrerillo)
Destructor without constructor
 
I'm trying to create a little brother of shared_ptr. Until now I failed miserably. Following code: #include <iostream> #include <map> #include <assert.h> name...
[7 replies] Last: So, I'd say no move if not explicitly told. I don't want it since I wa... (by coder777)
class and its implementation.
 
Can someone please explain every line ? i am having trouble understanding this project. PLease explain atleast till eval vertical function. #include <iostream>...
[4 replies] Last: okay i have solved the problem for evla {vertical ,horizontal, leftup ... (by riyadhhossain01)
Error unknown type vertices?? last few lines
 
#include <GL/glew.h> #include <GL/glut.h> #include <stdlib.h> #include <stdio.h> #include <math.h> #include <unistd.h> GLuint texturediffuse, texturesphere, ...
[1 reply] : Hi, First up, please always use code tags: http://www.cplusplus.com/a... (by TheIdeasMan)
recursion why does it not work?
 
// Example program #include <iostream> #include <string> using namespace std; void rec(int); int main() { int number; cout << "enter t...
[4 replies] Last: thank you wolfycplusplus, found out the silly mistakes i made. (by rezy3312)
by Phil15
Never Redefine an inherited nonvirtual function
 
Hi, recently I was wondering what happens underneath during compile time when running the code below. why is the function of class B not called? Is it be...
[7 replies] Last: All clear. Thanks everyone ! (by Phil15)
Need to finish the asigment
 
i need to create a class that represents a polynom of the fourth degree with int coefficients. Define suitable interface to the class as a constructor(s), set a...
[no replies]
How to create an Ammunition C++ class for a game?
 
Hello. I'm making a FPS game with Unreal Engine. I can't find a good way to achieve a good Weapon/Ammunition system. Let me explain: I have different kind o...
[5 replies] Last: Something along these lines, perhaps: enum ammunition { ROCKET, GREN... (by JLBorges)
Read a comma delimited data table
 
I have been trying to read following data table and create an object for the HUBs(rows) and another object for continent (columns). Since I am not a C++ experie...
[1 reply] : If you are familiar with regular expressions: #include <iostream> #i... (by JLBorges)
April 2016 Pages: 1... 56789... 23
  Archived months: [mar2016] [may2016]

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