49,761 Topics
| |
Hello, I am new to posting, but have searched these wonderful forums for a couple years. I am programming a game as a hobby. And I have been searching for a way to read what the user types. e.g. User types in "hello" and I can take that and send … | |
I'm trying to make a deck of cards; I want it to keep track of the cards that have been drawn. Will this code delete the card that is displayed? [code] void Deck::draw_card() { int random_card = (rand() % cards.size()) - 1; cout << "\n" << cards[random_card].name << "\n"; cards.erase(cards.begin() … | |
[code] #include <iostream> using namespace std; class X { public: X(int) { cout << "X()" << endl; } void f() { cout << "f()" << endl; } }; class Y: public X { public: Y(int): X(1) { cout << "Y()" << endl; } }; class Z: public X { public: … | |
Im getting the folowing error while trying to implement a friend function between two classes. "Board.C: In member function ‘void Board::input(bool)’: Board.C:227: error: ‘class Piece’ has no member named ‘castSpell’ make: *** [Board.o] Error 1" Piece's Header file [CODE] #ifndef PIECE_H #define PIECE_H # include "Spellcaster.h" # include <iostream> #include … | |
struct list_link { int key; // identifies the data double value; // the data stored struct list_link* next; // a pointer to the next data }; struct list_link* create(int key, double value, struct list_link* next) { return 0; } the "struct list_link" contains two variables and a pointer. what exactly … | |
Hi all, Thanks for reading my post! So up until now I've been using Emacs (or Aquamacs on my Mac - essentially the same thing) for software development and I really do find that I can work very quickly with it. Recently, I've been thinking that maybe there is something … | |
Dear DANIWEB community members, I am a newbie with Windoze programming, and I hope you could help me going with my project as I have a really just a technical question: I have a simple GUI with some buttons and text boxes defined in a form .h file, and I … | |
im doing this project to work it prints out all information except the radius it just gives 0,0 but needs to give locations provided in code. [CODE]#ifndef SHAPE_H #define SHAPE_H #include <iostream> using std::ostream; class Shape { friend ostream& operator<<(ostream &out,Shape &s); public: Shape(double = 0.0,double = 0.0);//default constructor double … | |
I am currently trying to write a C++ program. The intent of the program is to guess what side a coin is going to fall on, heads or tails. I feel like I am very close to making it work. But I can not seem to figure out how to … | |
I am needing help with programming challenge problem 12. It will compile, however, its does not make the array twice the size of the argument array. The problem says: Write a function that accepts an int array and the array's size as arguments. The function should create a new array … | |
Hi there, ok, im fairly new to c++ and have been trying to figure this out for ages: I have a text file i want to read in that contains lines and lines of lat long points; N50 42.22 W002 55.33 N50 42.22 W002 55.33 N50 42.22 W002 55.33 i … | |
Hey folks, i have a problem with a vector im attempting to program. There are no compile errors but during run time i get an error saying: "Debug Assertion Failed! Program:...filepath\GA.exe File:...include\vector Line: 779 Expression: vector subscript out of range" etc... I have tried stepping throught the program to no … | |
Hello all, I am having a problem with a c++ assignment. The basic problem is that I have two functions -- one to compute the mean and and one to compute the variance of a subarray from a main array -- arraym.I keep getting an extra parameter in call error … | |
Looking for an intermediate c++ book; to give you sense of where i'm coming from. I just finish "c++ for dummies",which isn't half-bad. I made the mistake of getting Bjarne Stroustrup's book a bit too early. I was thinking of getting: Thinking in C++, Volume 2: Practical Programming and/or Practical … | |
For my program I am supposed to implement an encryption and decryption algorithm. You will read the input from a file, “plaintext.txt” The file will contain plaintext strings that are all lowercase, and be of the format: 3 hello world 2 how are you Each line contains an integer as … | |
Hello, I created a linked list and implemented a deep copy function. However, the copied list skips the head node in the source list for some reason. So assume source list contains the following data in their respective nodes: 1 3 6 7 10 312 The copied linked list will … | |
SKIP to LINE 117 [CODE] #include <iostream> #include <windows.h> #include <fstream.h> #include <stdio.h> #include <stdlib.h> using namespace std; char n , p , m , L , F , E; int v , x , y , O , z , q , R; int main() { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14); cout<<"This … | |
GENERAL DESCRIPTION A prime number is an integer greater than 1 whose only integer factors are 1 and itself. A right-truncatable prime number (or right-prime number) is a prime number that remains prime as each of its rightmost digits is removed. For example, consider the value 719. 719 is prime, … | |
Well, please excuse my noobiness, and my little skill with C++, but give me a break, I'm young. Not for homework, just for the sake of being able to do it,I was trying to make a code for the Pythagorean theorem, and here is the start of the code (of … | |
Hi, I have a following problem. I have a number in string, for example "123456" and I'd like to convert it to int. This would not be a problem if I knew that the input number will always fit into an 32 bit integer. So if it won't I should … | |
Hey just wondering if someone could help me please with the following: board.h [CODE]public: Piece* Player1Pieces; Piece* Player2Pieces;[/CODE] (a section showing the initialization of the arrays) board.C: [CODE]Player1Pieces = new Piece[18]; Player2Pieces = new Piece[18]; char arrX[9] = {'a','b','c','d','e','f','g','h','i'}; for (int FootCount = 0; FootCount < 9; ++FootCount) { --->> … | |
hello fellow programmers. I am having an anoying problem with a Contact book i am making. As the title of this thread suggests i am getting that error but only when i call for a specific function in the program called void search(). All the other functions in the class … | |
Hi, new to this so go easy. I'm trying to store a function i wrote in a file and call it with a header file rather than copy and paste as ive been doing but i keep getting error messages from the compiler. Can anyone point out what i'm doing … | |
If I'm creating a new char[] to read in a text file: [code]char* pbuffer; pbuffer = new char[length]; [/code] what is the maximum size length can be? Would a std::string be better? pbuffer will only be allocated one time in scope no matter what, and length is not known until … | |
Hello, I have this probelm posted below. I pretty much have it figured out and it is still in rough draft form. I know it could be optimized better but, I'm not quite sure how to get it to look better. Although, the main reason I am looking for help … | |
I have a machine that waits for short/long periods of time, and some data that I am writing to the server is being ignored during the transfer. If the machine waits for more than 10 minutes, roughly, I noticed 2 global variables aren't getting reported. The delimiters before and after … | |
Hi All Can anyone tell me about some good tool to auto indent the code c++/objective-c/c with some customization features. | |
Hey guys, so my assignment is making a program that takes 2 measure objects and multiplies them together and displays them in square feet. What I'm trying to do is convert the feet into inches for both of the measure objects, then multiply the added inches together. Then I'm trying … | |
Interstate Motorway Pty Limited requires you to design a program that will produce, among others, customer statements for passing through E-way checkpoints of four toll stations (denoted by A, B, C and D respectively) distributed on the nationwide motorway. The charge of each pass is specified as follows Station A … | |
Hi guys, i just written a simple program which requires some date verification. However im facing some trouble with the input Problem 1: if the input has more than 8 chars, garbage characters gets printed Problem 2: if input contains invalid values(like negative), error gets printed Problem 3: if input … |
The End.