Beginners - November 2014 (Page 4)

Reading Tab delimited file into array
 
I have a text file that I need to search records in. The records are saved line by line in this format ID NAME SCORE1 SCORE2 SCORE3 .... They are all separated ...
[7 replies] Last: You are very welcome, if you run into any trouble let me know on here ... (by megatron 0)
by xx1182
What's wrong?
 
I'm making a simple Snake game in SDL, but when i'm making the grid isn't supposed to go like this: void SnakeGame::SetGrid() { SDL_Rect filler{0,0, 1...
[no replies]
Can't think my way out of this one
 
Morning all, My code works, but I'm having trouble implementing some logic, let me give you the run down. void Search(std::vector<Item>& db, std::vector<std...
[8 replies] Last: Thank you my man, you've been a great help. (by megatron 0)
if statement error
 
whichever number I type it is showing row 1. can anyone help please here's the code #include <iostream> using namespace std; int main() {cout << "cho...
[1 reply] : x=234||56||12 It is wrong on so many levels: x=234 ← assigment. ... (by MiiNiPaa)
Is there any method to generate large factorial numbers using C++?
 
I use the following function for generating factorial numbers: long long factorial(int n) { if(n==1) return 1; else ...
[1 reply] : You need arbitrary precision math library (or write ony yourself) (by MiiNiPaa)
What is wrong with this code..?
 
This is going to be utterly stupid I am sure of it.. The code the way it is written is not allowing for the else statement and is always evaluating to 'true' ho...
[4 replies] Last: IsEven function doesnt make any sense til you put parameter on it for ... (by xenovia12)
by Aliff
graphic computer (c++)
 
I need your help for this #include <string> #include <iostream> #include <windows.h> #include <shellapi.h> #include <gl/gl.h> #include <gl/glext.h> ...
[1 reply] : Please include all code, in code tags (put around your code), as ... (by TwilightSpectre)
Copying one struct to another
 
I have a class in which one of it's member variable is a struct. The constructor of the class get the struct as parameter, such the member variable are able t...
[6 replies] Last: my example worked fine. use member initializer list in constructors in... (by anup30)
Inheritence problem
 
Program isnt compiling. I think its a problem with my calls to two. #include <iostream> using namespace std; double Balance = 1000; double amount; c...
[10 replies] Last: I figured it out. I needed to add a "=0" at the end of line 10 and 11.... (by Rashad2)
Constructor for class must explicitly initialize the base class don't have..
 
Cnstructor for class must explicitly initialize the base class don't have default constructor. This is the error I get from my constructor.. Could someone hel...
[2 replies] Last: Hey.... I guess you might need .. move poly into scope . I mean ... (by closed account SECMoG1T)
Overloading operator<< in friend function
 
If I have a template class called object_class , and I want to overload the operator << by using a friend function, I would use the code below within the heade...
[2 replies] Last: What is the full name of your book, by the way? My book is called ... (by DyslexicChciken)
i can't figure out my syntax error.
 
so my program works for the most part, but when I was testing it with cmixii it gave me 911 instead of 992. I don't know where i went wrong. please help. ...
[2 replies] Last: There is a C++ function that changes the case of a character, it is us... (by closed account 3R5fjE8b)
Push_back location of string in a vector to a 2d vector?
 
Hi, I'm a beginner in C++ and I would like to know how to find the location of the same words in a vector<string> and push them into a 2d vector. for example: ...
[1 reply] : There are many ways, depending on what you are allowed to use. I give ... (by ats15)
Random Word Generation
 
Hello! I'm creating a program to input a list of words from a file into an array. From this point, I'm trying to randomly select one of the words stored within ...
[4 replies] Last: Ah! I understand now. Thank you so much for your advice and help! (by Chipchip)
by vaibek
copy vector content into an array exercise.
 
I am currently working through C++ Primer 5th edition. In chapter 3, Exercise 3.42, I am asked to "Write a program to copy a vector of int's into an array of in...
[1 reply] : 1. You can't. You'd need to dynamically allocate it with new , and c... (by LB)
by Ganado
Question about decltype
 
Two small questions about the use of decltype //Function: namespace line { inline std::function<Coordinate(double)> path(const Coordinate& start, const Co...
[9 replies] Last: Oh yeah, forgot you where using a vector. Gets even worse, now: void... (by TwilightSpectre)
classes and objects
 
hi guys can tell me whats the op of this program and if there is some mistake please rectify it. #include<iostream> using namespace std; class customer { ...
[1 reply] : [quote=gaurishankar]whats the op of this program I do not understand. ... (by LB)
Using copy constructors from base class
 
When you initialize a copy constructor in a class, called derived_class_ , that publicly inherits another class, called base_class_ . You can use the initiali...
[1 reply] : 1. The base class is constructed first, then the derived class is cons... (by LB)
Function help
 
Hey! I'm currently working on a project but I just can't seem to get my functions to work properly, the first works fine, but the second doesn't do anything. I...
[5 replies] Last: Apologies, just tried it out again and it worked. Thanks for your ass... (by davewdxb)
vectors and structures
 
I'm trying to create a program that use 2 structures, 1 to hold user account credentials and another to hold user information as well as a vector of account cre...
[1 reply] : I just switch the placements of the 2 structures and now it works. I'm... (by skimmer001)
November 2014 Pages: 123456... 65
  Archived months: [oct2014] [dec2014]

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