49,756 Topics
![]() | |
This is as much of a question about algorithm as it is about code. I’m training monkeys to input data into a keyboard in the form of a table. I have created a special keyboard with nothing on it but numbers 0 - 9, a period, tab key and a … | |
Hi everyone, How do I make sure that user input is of integer data type. not char nor alphanumeric..? when the user inputs character string or alphanumerics it should output "Please enter an integer" Is there sopme wayh to do this? Thanks. | |
![]() | Consider all the sequences with length (0 < N < 44), containing only the elements 0 and 1, and no two ones are adjacent (110 is not a valid sequence of length 3, 0101 is a valid sequence of length 4). Write a program which finds the sequence, which is … |
Hi guys, Well, I am currently taking a C++ course focusing on learning about object-oriented design concepts, including polymorphism. The assignment I am currently working on involves the creation of a point-of-sale system. The details of the problem are quite involved and challenging (for me, at least!). I am determined … | |
I've been trying to use member functions from a class (prototypes define in counter.h) in my main file. The class implementation is in file counter.cpp and i am trying to compile countertest.cpp. The error message is : g++ countertest.cpp Undefined symbols: "counter::counter()", referenced from: _main in ccmTnGJX.o _main in ccmTnGJX.o … | |
I know that the .txt file is being opened correctly, however, I don't know why the getline function is not storing the first line and outputting it correctly. [CODE]//Joseph Yong //CSC2430 //Homework 7 //Main File #include <iostream> #include <fstream> #include <string> #include <iomanip> #include "Customer.h" using namespace std; Customer cust; … | |
Hi, I have code as follows wherein I pass a 2D array to a function and want to receive this array with its contents tripled. [CODE]#include <iostream> #include <cstdio> using namespace std; int** test2 (int arr2[][4],int mul){ for (int i=0;i<2;i++){ for(int j=0;j<4;j++){ arr2[i][j]=arr2[i][j]*mul; } } return arr2;//sending back the address … | |
I'm trying to teach myself classes. I decided to create a class to represent a date. It's more for me to learn than to actually be useful. When I have the variables month, day, and year under private setting, the program will not compile (I am using Dev C++). When … | |
Hi guys, I'm having a few problems with my code. I run the program and input 10 users for my account system, but when I try to recall the values for any account, I can only call the first balance I entered. I've been looking at the code, trying to … | |
The queue class needs to inherit protectedly from the list class My code won't compile because of this line towards the bottom listPtr = &myqueue; if i comment out this line, it compiles and runs, but without this line i can't do what i want. I need this line to … | |
My Question: I have created a text file named it kashif.txt and i have placed this file in the same folder where .exe and .ccp of this program is placed but file is not opening. My code is as under. #include <fstream.h> #include<iostream.h> main() { char name[100]; char sal[100]; char … | |
I need a Huffman code can run.Thank You a lot I need a Huffman code can run. I was looking on google but my English is limited and can not find exactly. | |
hi this is a program to perform insertions and deletion in doubly link list... | |
i am currently new to c++ coding and i have been working on this code for a class, i am suppose to get emails from a .txt file and the program reads each line of the file analyzing each and every char of every line to see if it is … ![]() | |
Mucking about (should say practising what I've learn't), and made my version of the rabbits practice program. It's not totally finished but it's my first draft and it's working. Before continueing, I'd like a code review please to tell me whats not correctly done or how I could improve my … | |
I have my class in 2 different files(header and source-file) and i have 2 variables which is a const but the only way to give the const variable a value is to do it trough an constructor initializer. But how do i implement an constructor initializer in my class ? … | |
hi i want to give my sprites some weapons- one a gun and the other a sword but i have no idea what i am doing, can anyone help me do this please? i've included my main.cpp, player.cpp and player.h if it helps.. im using visual c++ and SDL and … | |
I am writing the following program that calculates the average of a group of test scores where the lowest score in the group is dropped. It has the following functions: void getScore()-should ask the user for a test score, store it in a reference parameter variable, and validate it. This … | |
Hello, i'm new to daniweb and also quite new to C++. I'm trying to write a function that takes a filename and a string query like [CODE]string GetStringValue(string filename, string query) { /*...*/ }[/CODE] then finds the query in the file, and returns what's behind the = mark. the file's … | |
I have tried to start this program but I am so confused with dealing with strings. If any one could take a look and tell me if im on the right path it would be greatly appreciated. Heres the problem and what I have so far: An organization wants to … | |
I have made the following code to find a string in some lines of text But it always mentions the error: no matching function for call to 'strcmp(std::string&, std::string&)' [CODE]#include <iostream> #include <string> #include <fstream> #include <sstream> using namespace std; int main(){ cout << "Please enter some text" <<endl; string … | |
i am currently working on a program that validates email addresses. i have finished the code to open the user file and read every line in the file and processes every characater to check if there is one "@" and a "." then prints to the console. i am now … | |
Hello all I am a beginner in image processing and would like to know how i could get the coordinates of an image which is displayed in a window. I work on the visual studio platform to implement my c++ codes. Could someone help me with this please Thanks in … | |
Hello, I am in the process of writing a board game, and part of that game involves having a user click on a hexagonal tile, and when they do and certain conditions are met, the tile should change color to match the player's color. Below is a sample program which … | |
I want to print out the letter B, instead I get a blank line. Any tips would be great [CODE] #include <iostream> using namespace std; void add(string n); int main() { string B; add(B); } void add(string n) { if(n.length() <= 1) { cout<<n[0]<<endl; } }[/CODE] | |
Hello everyone, I'm having a hard time figuring out what is wrong with my codes. I have a set of arrays and I have to sort them in order to find the median. I made the function to find the median and I tried recalling the function but it keeps … | |
I need help when i run the app. and enter the wrong answer "No. please try again " continues to loop forever . I want it to say it only once and repeat the same question. Any ideas? I thought maybe the braces were off somewhere but I'm not sure. … | |
[CODE]//Form1.h (Windows Forms Application) //.... //.... #pragma endregion cli::array <String^> ^sum; private: System::Void BtnComp_Click(System::Object^ sender, System::EventArgs^ e) { nocarrystate n; carrystate c; char a; states * curstate; states::init(&n, &c); String ^text1 = TxtBin1->Text; String ^text2 = TxtBin2->Text; curstate = &n; int i = 0; int len1 = text1->Length; sum = … | |
I am having trouble with generaetOutput function the void part is throwing me off. I tried to do it like the genrateQuestion function but the void part has me confused. Also my while statement is missing something because the error message continues to loop and if the user enters a … |
The End.