49,761 Topics
| |
I'm having the hardest time figuring out why my password check loop won't exit after excepting valid input. Can someone help? [CODE]#include <iostream> #include <vector> #include <string> using namespace std; int main( ) { vector<string> credentials; string login; string userName; string password; string CheckPassword (string password); cout << "Enter user … | |
Can someone show me how to change the cases down below to call functions for add, subtract, divide, multiply. Also return the answer back to the case to display the result in the case. Prototype the functions before main and add the function definitions after main. [CODE]#include "stdafx.h" #include <iostream> … | |
Hi , i wrote this program i am having problem its giving me error whenever i hit case 1 can any1 give me a suggestion what i am doing wrong [CODE] #include <iostream> using namespace std; #include <string> int main() { int y; int x; int ur_choice = 0; int … | |
Hi everyone. I've been fighting with a piece of incomplete code for a while now, and it's really frustrating... particularly because it's due tomorrow. Anyways, when I try to compile my project it's spitting out linker errors at me: [Linker error] undefined reference to `clearBoard(int, char)' [Linker error] undefined reference … | |
Hey All, I've been stumbling into the same (annoying little) problem a couple of times, and I'd like to find out how to fix it properly. Pseudo code [code=c++] // file A.hpp #include "classB.hpp" class A { A() }; // file A.cpp A::A() { } [/code] [code=c++] // file B.hpp … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 :) | |
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)) … | |
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 … | |
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 … | |
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 || … | |
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> … | |
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 … | |
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 … | |
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, … | |
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(); … | |
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 … | |
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 … | |
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 … | |
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!!! … | |
(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=="/") { … | |
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 } … |
The End.