Beginners - May 2015 (Page 38)

compiler error when filling a vector with info from a class.
 
Hello, I need help filling a vector that is in a class I created called List, with info that is input into a class called Item. I get one compiler error that sa...
[6 replies] Last: Thank you for the answer and the advice. I have lots of code working n... (by AC DC Bag)
std::bind question...
 
On msvc2013 I can do this: class c { void member_function(int x) { std::cout << x; } void test() { std::function<void(int)> fn = std::bind(&c::member_functi...
[no replies]
Number Analysis program
 
I'm trying to write a program that asks a user for a file name, which contains a set of numbers. The program should should read the contents of the file into an...
[4 replies] Last: now it has this error LINK||fatal error LNK1181: cannot open input ... (by danieldd7)
Passing by reference?
 
So this is my first project from an "introductory" programming course that I already turned in and was graded but couldn't figure out how to do ONE thing. It is...
[3 replies] Last: Yeah so I went ahead and said what you said to do. I was over thinking... (by ElTucan)
Passing pointers to functions within functions URGENT.
 
I have a lab due tomorrow, so thanks for a quick reply. For some reason, my pointer won't cout when it comes to the printInventory function. I printed it in th...
[1 reply] : readFile should take count by reference (or by address if you prefer... (by cire)
Slot machine program , I am stuck.
 
So I am trying to program a slot machine but the few problems I have encounters all lie in random number generation my main issue is how do I make truly random ...
[2 replies] Last: You won't get a truly random number. But there are pseudo-randoms: htt... (by Homberto)
by mkiopl
multiply problem
 
ok so i got this code and x=1.5 and y= -2.5 instead of giving me a=0 and b= -3, it gives me a=0 b=0... can you guyz please explain me why ? and the answer ple...
[4 replies] Last: if(a<b){ w=a; a=b; // <------------------- y... (by chipp)
Need help with creating classes to hold user data
 
I am trying to create a class, or set of classes, wherein one class will contain code for user login (user ID and password will pull up the user name, and butto...
[1 reply] : Since you say this is is partial code, it's not clear if: 1) you've i... (by AbstractionAnon)
compiling on windows problem
 
when i try to compile my project on codeblocks it gives this warning which i can not solve C:\Program Files (x86)\CodeBlocks\MinGW\include\winnt.h|2399|e...
[1 reply] : Websearch with those words. Of the hits I get, this might be close: h... (by keskiverto)
Help with Switch Statements
 
I'm working on combining two programs I've already created. Problem is, I need to use switch statements in it. I understand what they do, but I'm confused on wh...
[10 replies] Last: Alright, it works great now! Thanks! (by GigaBatz)
by Guner
Reverse a string
 
Hi i need to reverse a string in C++ and i already have the following code but i keep getting errors can somebody help me out? #include <iostream> #include...
[16 replies] Last: There are several ways to do this.Do you have something specific in mi... (by konstance)
by Thecal
Put values into an array from cin
 
I am trying to put values from cin that is put in before a loop, into an array. However, when I output the array, the values are not stored in. (Actually garbag...
[13 replies] Last: Perfect. Thank you all. (by Thecal)
Question regarding object of class
 
is it possible to insert the object of a class in the linked list. I have created a class, so i wanted to put its object as a single node in linked list.
[1 reply] : use std::list http://www.cplusplus.com/reference/list/list/... (by shadowCODE)
Paralysis effect not functioning properly
 
I'm making a battle system in C which incorporates things like attacking, defending and casting spells. It's a console app, so nothing too fancy. One of the pro...
[16 replies] Last: modular programming is a design methodology like OO. it's down to whic... (by Jaybob66)
How do I get the name of an object that's been created through it's class?
 
I'm skimmed the code down to only highlight what I'm having trouble with. I have a class that creates a window. I want to be able to save the name of the obje...
[2 replies] Last: for class name(type name): http://stackoverflow.com/questions/3649278/... (by shadowCODE)
Question - compound operators
 
Hi Guys, trying to figure out why the value of a is 26? Can anyone clarify this? I get 16 if I work it out manually. #include <iostream> using nam...
[2 replies] Last: line 11 is: a = a + (BONUS - (a/2)) . That should give you 26.... (by shadowCODE)
Linked List not appending?
 
My professor is having us work with linked lists and create a "shopping list" with two different types of items (price by the pound, and each item). I'm able to...
[1 reply] : can you show us the showInfoP() function so we can see what it is expe... (by Jaybob66)
by savanh
question
 
why it does not run ? #include<iostream> #include<string> using namespace std; class mark{ public: int point; mark(); mark(int m){ point=m; } m...
[2 replies] Last: thank u so much (by savanh)
Strings
 
My doubt is while accessing the values using arrays like (names ) we can access values stored in array but while we are writing &names it means we are printi...
[1 reply] : you are correct the & means address of. and because you specify both ... (by Jaybob66)
Confused on a minor for loop in Hangman project
 
I'm building a simple Hangman project, it reads an external text file into an array. That works fine but I want to add a loop to make it display the correct wor...
[5 replies] Last: I got it to work, I simply placed a break before the loop closed. Than... (by DragootKlaus)
May 2015 Pages: 1... 3637383940
  Archived months: [apr2015] [jun2015]

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