Beginners - March 2014 (Page 42)

Count values in array.
 
I am having an issue with my scoring method for a game called Yahtzee that I am writing for my school. I am using an array to store the final dice roll in but ...
[2 replies] Last: for( size_t i = 0; i < 5; ++i ) { switch( die[ i ] ) { ca... (by nvrmnd)
Please help me to make a function stop/return an error without returning any value
 
I'm having an assignment to implement a stack class using singly linked list and here is my Pop function: #include <iostream> using namespace std; struct No...
[5 replies] Last: You have four typical options; choose one, and document it. Option o... (by JLBorges)
Passing arguments by pointer question
 
Hi I'm currently learning C++ and I got to an exercise that asked to create a function that swaps two ints passed in by pointer. Here is that snippet of the pro...
[6 replies] Last: yes, Wallboy it depends on what library you are using, try to use othe... (by closed account ivDwAqkS)
Vector Index Access in Class
 
How do I access the vector index in the class function 'GetIndex' below? Please don't get wrapped up around the example I'm using. This is just to illustrat...
[2 replies] Last: Ok, here is what I'm trying to do. In order to calculate the Point() ... (by HellfireXP)
How do I fix this code?
 
I'm trying to work on a program that does even division only. But I can't get multresult to be less than highestNum how do i do that? for (int count = 1;...
[2 replies] Last: @soranz Er, no, calling rand() twice in a row like that is perfectly... (by long double main)
by enemy
Class does not accept private for variables- WHY
 
Hello! Please, why is here giving an error? It CAN be public, but why can't it be PRIVATE??? Many thanks!!! #include<iostream> using namespace std; ...
[6 replies] Last: Ah, sorry about that. Edited my post. (by closed account 18hRX9L8)
by qzpqzp
Loop
 
3 options. Let them be 1, 2, 3. And let 2 be the right answer. I need the program to loop back to the question if the user enter either 1 or 3. I have ...
[5 replies] Last: while (selectionA != 2) { cout << "I'm sorry, my responses are li... (by long double main)
Validate input as 0's or 1's in string array
 
Wanting to know how to check that 9 characters entered into a string variable are either a '0' or '1'. Want to convert string to c-string array and validate eac...
[1 reply] : No need to convert anything to a C string: for (unsigned i = 0; i < v... (by long double main)
Trying to grab info from a text file
 
I cant seem to get my program to find the .txt file I have created. Is there a particular spot I should create it? The code I have is below. The program just a...
[1 reply] : The first two lines are redundant. I don't know if attempting to open ... (by Daleth)
Strange Syntax/Question
 
Hello all, Here are the functions for a clone of the pong game. I am hoping that someone can help me in knowing why the programmer used parentheses around th...
[3 replies] Last: Thank you. That makes a lot more sense now. I've just never seen type ... (by mlholder)
Having trouble returning values
 
I have to compute the area of a circle in a fuction called area. Main is supposed to prompt the user for the radius first. I keep getting that the variable area...
[1 reply] : Yes to the compiler "areacircle" is undefined because its a parameter... (by Codermik)
by stdeez
overloading operator =
 
class Edge{ public: Edge(); Edge(int v1, int v2, int weight); int first(); int second(); int edgeWeight(); void operator=(E...
[1 reply] : Your thread title suggests you are overloading the assignment operator... (by Daleth)
Input validation with objects
 
I have to create an Inventory class with the member variables int itemNumber; int quantity; double cost; that can set and get values for the above. I need ...
[1 reply] : //File: Inventory.h - class Inventory declaration file #ifndef INVEN... (by heyyouyesyouiloveyou)
by Alby94
Operator=
 
class Base { Base* operator= (Derived<int>* x) }; template <typename T> class Derived : public Base { private: T a; public: Derived (T x) { a = x...
[4 replies] Last: Therefore how to define an operator= for Base* ? Edit: i understand, ... (by Alby94)
by kim12
Tic Tac Toe?
 
Figured it out.
[4 replies] Last: Sorry, I can`t help. You just have to wait till the pros are on :D. Yo... (by closed account EwCjE3v7)
Do not understand this while loop
 
What does this mean, I`m so confused EXCER: What does the following program do? #include <iostream> #include <cstring> #include <vector> using std:...
[2 replies] Last: Thank you kbw, I was right after all, :D well thats what I thought. Wh... (by closed account EwCjE3v7)
basic If control
 
ok so have just started to learn C++ and im wanting to check all arguments to call out errors when it finds a character. Ive been able to get it to work but hav...
[9 replies] Last: @ cire: Because it kinda looked weird lol. (by Stormboy)
opencv updating code to c++
 
I have a very small simple function using opencv libraries which takes a source image and stamps it to a location on a destination image. No matter why I try I...
[no replies]
Class 'Friend' Useage
 
In the code below, I'm trying to consolidate the "private" members of these two classes. CELL is a part of grid. When a grid is created, it creates a bunch of...
[2 replies] Last: Point() is a function that returns the upper left corner X and Y value... (by HellfireXP)
by stdeez
Reading input files
 
5 4 1 2 45 1 3 4 2 3 16 2 4 6 3 4 8 This is my input file format. What I need to be able to do is to process a specific line, say line 2. I need to...
[3 replies] Last: According to many opinions on the internet.... int vertexCount = line... (by stdeez)
March 2014 Pages: 1... 4041424344... 79
  Archived months: [feb2014] [apr2014]

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