49,757 Topics

Member Avatar for
Member Avatar for learner guy

Hi newbie there,this is code for chess game(just started) ,i want to convert the input in characters to integers via getMove function i have tried to made but its not working.. output is "invalid input" every time [CODE]#include <iostream> using namespace std; void printBoard(char board[][8],int row,int col); void getMove(int arr[],char …

Member Avatar for learner guy
0
199
Member Avatar for eskimo456

Hi there I'm not to sure if this should go here or in games development so please move it if required. I'm trying to make a basic function that allows my character to jump. The basic idea is to check if the character height is equal to that of the …

0
223
Member Avatar for mzimmers

Hi, all - I'm relatively new to iterators, and to template functions, so I suppose it was inevitable that the first time I tried to combine them, I'd run into a problem. Here's the function: [CODE]template <class T> int getVectort(ifstream & s, long nbrCells, typename vector<T>::iterator iter) { int rc …

Member Avatar for mzimmers
0
613
Member Avatar for lmytilin

Hi everyone! I am trying to understand tolower function... I don't get the locale variable to be honest and I would also like to know what I have to do so as to save the lower case string to another string and not just print it! That's my code... [CODE]#include …

Member Avatar for mrnutty
0
104
Member Avatar for pudge343

Need some guidance with this program. Never had experience with sentinels so I'm not sure where to start to calculate the multiple grade inputs. [B]Requirements:[/B] [LIST] [*]Sentinel needs to be used to indicate when there are no more students to process [*]Will read data about a student one at a …

Member Avatar for Schol-R-LEA
0
244
Member Avatar for mftbob

Hello. I need help in completing my c++ assignment. Below are the question details: [COLOR="red"]Develop a simple Paper-Scissors-Rock program. Make it a single player game where the player plays with the computer. The party that accumulatively wins 3 times first will win the game. Option: Your program may include a …

Member Avatar for Schol-R-LEA
0
4K
Member Avatar for johnnycock

I need help making a vector to shuffle the deck of cards randomly as well as picking a card from the top of the deck, then discard a card back into the deck. The program should then reshuffle after cards have been discarded back into the deck. [CODE]#include <iostream> using …

Member Avatar for pseudorandom21
0
123
Member Avatar for Guipborges

Hi everybody. I have a simple problem. Need send the c++ output to excel(csv->xls or xls direct) in formated data. I can send the data to excel, but i can´t format that like this: |_ col 1__|___col 2___|___col n____| row 1......|....2row 1 row 2......|....2row 2 row 3......|... 2row n What …

0
139
Member Avatar for itzcarol

Problem 1: Magic Squares: An n x n array, that is filled with integers 1, 2, 3, …,n2 is a magic square if the sum of the elements in each row, in each column, and in the two diagonals is the same value and each value in the array is …

Member Avatar for jmichae3
0
2K
Member Avatar for imsinu

if i hav to input time of clock as formatted style(HH:MM:SEC) using cin how can i write its code???? a question from @robert lafore(sams publication) . hope to get a best answer soon :)

Member Avatar for imsinu
0
191
Member Avatar for physicist

Dear Friends Can you help me to convert the following code from c into c++ and save the file as file.cpp. I would do that in order to use cout instead of fprint and for another reasons. [CODE]#include <stdio.h> #include <math.h> #define pi 3.141593 #define F(x) ((*f)(x)) #define sqr(x) ((x)*(x)) …

Member Avatar for Schol-R-LEA
0
410
Member Avatar for taylor0934

I am having trouble starting, I have the default constructor. Just set Head, Tail, Pred and Succ equal to 0. The copy constructor I am having problems with, don't know where to start. [CODE]enum Direction { front_to_back, back_to_front }; template <typename EType> class PQueue { private: struct Node { EType …

0
85
Member Avatar for coroshea

It's only supposed to return the celebrities that contain the keyword the user searches for :'(. Instead it returns everything. Eg. they enter the following: Reba McIntire OK George Clooney KY Enter keyword: KY It should only return George Clooney. Instead it returns all of them in the list. Try …

Member Avatar for coroshea
0
180
Member Avatar for kjcjk

When I run my program it ignores the cin and goes into an infinite loop. It acts as though the cin.ignore() isn't working. [CODE] int getInput(int tries){ int numGuess = 0; cin >> numGuess; cin.ignore(); validate(numGuess, tries); return 0; } int validate (int input, int tries){ if (input <1 || …

Member Avatar for WaltP
0
233
Member Avatar for lmytilin

Hello guys! I have to create a program that prints the last 10 lines of a text or all of it if the number of the lines is <=10. The input will be a file that is unknown to me. This is what I've done so far. [CODE] #include <iostream> …

Member Avatar for WaltP
0
584
Member Avatar for nyuszi

hi, i need a little help. i have a 2d array adn i want to write out each rows minimum number. but something isnt good cause if the minimum is in the last position it says that the first number is the lowest. heres the code: [CODE] void minki(int k,int …

Member Avatar for nyuszi
0
136
Member Avatar for kingcong83

I am a beginning at programming and need to know what I am doing wrong with this code. I keep getting error codes on undeclared variables, storage types, etc. [CODE] #include <iostream> #include <iomanip> #include <string> #include <cctype> const int ARRAY_SIZE = 100; void InputData(string, int[], int &); void DisplayPlayerData(const …

Member Avatar for Schol-R-LEA
0
155
Member Avatar for Ahmad Mansour

Hi ... I'm Civil Engineering student and beginner in C++ i faced a problem and tried to solve it but unfortunately can't i just want a help and headlines to solve it.. and thanks the problem is: Write a program that will print the following on the screen using loops, …

Member Avatar for PrimePackster
0
90
Member Avatar for lo0lo0999

Now I'am using Microsoft Visual Studio to compile this program in C++ but when I compile it I have so many 00000 with no end for this procces.. [CODE]# include<iostream> using namespace std; # define SIZE 5 class queue { private: int a[SIZE]; int front; int rear; public: queue(); ~queue(); …

Member Avatar for lo0lo0999
0
301
Member Avatar for hcw88

Hi all, well. I need to create a push and pop operations using a stack class by using + and - operations. So far, my coding is: [CODE=cpp]#include <iostream> #include <string> #include <stack> #include <cctype> using namespace std; void Convert(const string & Infix, string & Postfix); bool IsOperand(char ch); bool …

Member Avatar for pseudorandom21
0
171
Member Avatar for salah_saleh

Hello!, I know this my be slightly unrelated question but it's very simple questions and I know many of you will find it very easy. I want to pass several txt files to my c code using make file, but I can't make it right, so please help me in …

Member Avatar for Fbody
0
440
Member Avatar for BoBok2002

I am struggling to write the push and pop functions for a stack of arrays. I know how to write the code to push single items unto a stack and pop them out. Some have suggested that I use an array of arrays (two-dimensional array) to load the array of …

Member Avatar for BoBok2002
0
1K
Member Avatar for squ200

hi all i have a problem and i hope someone will help me. i have this program and i want to find the absolute maximum difference between y1 and y2 ??!! i have found the difference between y1 and y2 but i could not find the maximum difference between them!!! …

Member Avatar for Moschops
0
213
Member Avatar for riahc3

(So continues the JNI saga....) I currently have this (in C++, this being my native code in C++): (x is a jstring passed thru the header) [code] jdouble res; if (x=="*") { res=a*b; } else if (x=="+") { res=a+b; } else if (x=="-") { res=a-b; } else if (x=="/") { …

Member Avatar for riahc3
0
144
Member Avatar for jeevsmyd

Suppose I have a simple program to find the largest of two numbers of different datatypes and return the largest.I'm implementing it as a template to support generic datatypes [code] template<class T,class U> T max(T t,U u) return (t>u?t:u); int main() { int x=70; float y=100.5; max(x,y); return 0 } …

Member Avatar for mike_2000_17
0
223
Member Avatar for eshalmj

[I]Could somebody please help me in this C++ program? I'm a beginner and have no idea doing this tutorial. anyone who could help me would be greatly appreciated. here is the question: [/I] Create an inheritance hierarchy that a bank might use to represent customers’ bank accounts. All customers at …

Member Avatar for divyakiran
0
883
Member Avatar for phorce

Hello, I have a map that contains the alphabet (key) and a double (value) and I would like to sort the list so that the highest value is at the top but it still keeps it's key.. E.g. [code] #include <iostream> #include <map> int main() { map<char, double> alphabet; alphabet['a'] …

Member Avatar for vijayan121
0
134
Member Avatar for youngyou4

Hey guys, I have an assignment that I have been working on for hours and I've done a lot of testing and I finally got it working, but when I try to change it to make sure to prompt the user for an input I can't get it to work …

0
75
Member Avatar for nuclear

Theres this thing that i dont fully understand. Im using this tutorial: [url]http://lazyfoo.net/SDL_tutorials/lesson08/index.php[/url] and i in here we first set up some surfaces with text and then asign their value to the message and then for some reason we have to reset the message value to 0 in order for …

Member Avatar for raptr_dflo
0
483
Member Avatar for fsefsef23

I'm finding myself stuck trying to simply get a userInfo class's sets to work, but every time I try and compile with simple code like this in my application file: userInfo stuff; stuff.setId("test"); It gives me one of those 'undefined symbol' errors and references to the userInfo::setId function: Undefined first …

Member Avatar for Moschops
0
161

The End.