49,761 Topics
| |
hi so why isnt queue printing anything where it should? #include<iostream> #include<string> using namespace std; template<class ItemType> struct NodeType { ItemType info; NodeType* next; }; template<class ItemType> class Queue { private: int size; NodeType<ItemType>* front; // It points to the front of a singly-linked list NodeType<ItemType>* rear; // It points … | |
I have solved it... Shame... -------------------------------- I have problem with this code: cin >> str; smatch m; regex e("([[:w:]]+)@([[:w:]]+)\.com"); //<- Here was the error (it was regex e("([[:w:]+)@([[:w:]]+)\.com");) silly me :(( bool found = regex_search(str, m, e); cout << "m.size() " << m.size() << endl; for (int n = 0; … | |
Hi, So I am working on a drink machine simulation. I have a text file that holds the prices, names and inventory. My problem is It won't let me set my prices at 1.00 or higher. Ex: I set the price to 1.50 in the text file then when the … | |
Using the sample BUBBLESORT program with CHARACTERS given in class do the following: Enter 10 words (does not have to be a phrase or sentence..you may use some digits, caps, and special characters like punctuation. Have each of these words including punctuation entered into a character array. Print out the … | |
Hello, I am trying to create a tone, then another tone using this code. It currently only plays one of them. Is there something missing or am i going about this wrong? for(int n = 0; n < num_samples; n++) //where n is the step |start of for loop { … | |
Hello everyone, i am going to create a small tune though i have no idea how to go about it. I currently have a sine wave that plays for one second using a loop similar to this // loop to generate audio samples for(int n = 0; n < num_samples; … | |
I am reading the (otherwise excellent) The C++ Programming Language (4th edition - Hardcover) (Stroustrup) and I cannot understand about 4 pages of it despite a lot of attention to it. It's section 27.4.1 Composing Data Structures starting page 767. After reviewing obviously unsatisfactory alternatives on page 767 for a … | |
hi so i have to make a copy of a linked list i made last week and this time i just have to update it with a deep copy concept thus making a copy of that list i made. here is my code: #include <iostream> #include <string> using namespace std; … | |
So I have this but I'm not really sure of how to print the smallest element of array `a` , print the sum of all the elements in array `a` , and print the average of all the elements in array `a`. Help please. Is this how to print out … | |
##Why Use Arrays?## Let's begin by considering why arrays might be needed. What is the problem that this feature solves? How does it make your life as a programmer easier? When studying new features, it's important to recognize what that feature does for you and where the incentive is in … | |
This AVI file player has some nice features like adjusting size and speed. The program uses the standard MSvfw32.lib (called libmsvfw32.a in the DevCPP lib directory). Another example of using BCX to translate to C code and modify to something Dev-C++ can handle. Enjoy!!! | |
When I try to compile the program at the bottom this is what I get. `-> qtprogram.cpp:1:24: fatal error: QApplication: No such file or directory` I got this code from a C++ QT book and I'm compiling this on Linux with this command. `-> g++ -g -Wall "${ARG}" -o "${ARG:: … | |
//The code contains 10 distinct syntax errors. //Rewrite the code, correcting all syntax errors. int _tmain(int argc, _TCHAR* argv[]) { int numStamps{4} = {0,0,0,0}; ProcessFileData(numStamps); DisplayDenominationTable(numStamps); double totalCost = CalculateCost(numStamps); cout << "Total cost of stamps is " << totalCost << " euro"<< endline; return 0; } //this is my … | |
Hi guys, I have small problem with my example code. Any hint? #include <iostream> using namespace std; class A{ public: int a; A(int i){a = i;} A(const A& rhs) // copy constructor { a = 2; } A(const A&& rhs) // move constructor { a = 3; } }; void … | |
Hello Does every function in C++ returns value? If yes what is that value and what is the use? | |
I have been racking my brain for a bit on this and just can't figure it out. The book "Object-Oriented Programming C++" by Joyce Farrell pg382 exercise 13. They're wanting me to make a class named "PlayingCard" that contains 4 fields which are values and suits in both numbered and … | |
Write a complete C++ program that reads the attached file (values.txt) to find and print the following: a. The average value of the numbers in the file. b. The maximum and minimum value c. The count of negative and positive values (ignore zero) #include <iostream> #include <cstdlib> using namespace std; … | |
The code isn't displaying and then reversing entered numbers. reverse.cpp // // #include <cstdlib> #include <iostream> #include "linkedStack.h" using namespace std; int main() { linkedStackType<int> stack1; linkedStackType<int> stack2; cout << ""; cout << "output your name\n\n"; int number = 0; // AUSE LINKED STACKS // cout << "Enter first number … | |
i want to understand that what is bolean data type in c++. I tried to my best but i can not understand boolean data type plz help me | |
Write a program that can do the following: addition of two matrices . subtraction of two matrices. multiplication of a matrix by a scalar. multiplication of a matrix by a matrix. | |
I am trying to write a code that checks if password is pass with the use of functions...but i am not able to ....Please help me i am a beginner....and i need this program to be written strictly using functions....thsnk u in advance | |
i am developing a project in c++ and i need database to save details.i googled but so far have bot come across a good tutorial for c++ database . most of the articles i have found are obsolete. please suggest what are APIs for database in c++? | |
Write a program that uses a for statement to sum a sequence of integers. Assume that the first integer read specifies the number of values remaining to be entered. Your program should read only one value per input statement. A typical input sequence might be 5 100 200 300 400 … | |
I'm having a problem accessing information between classes. The following simple program illustrates the problem. I have two classes. Int Cell and second. IntCell has a single data member: storedValue. I initialize the value of storedValue to 0, and then assign a value of 16 to it in main() on … | |
| This is the code that I have for inserting a node, but I don't know how to do the delete function. Any tips would be helpful // Constructor Tree::Tree() { root = NULL; } // Destructor Tree::~Tree() { freeNode(root); } // Free the node void Tree::freeNode(Node* leaf) { if ( … |
| Greetings everybody, I would like to ask you which C++ libraries you use for ethernet communication? In web I found several; [boost.asio](http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio.html) [Nut/OS](http://www.ethernut.de/api/index.html) [Sockets](http://www.alhem.net/Sockets/index.html) Is there another and easy? By the way, which one of these three libraries are easier to use :) . Thanks in advance |
Can you guys please help me understand when to use const? For example, if I have the following functions: viod add (int* array) { int total = array[1] + array[2]; } viod subtract (int* array); viod times (int* array); viod divide (int* array); viod printArray(int* array); and I only intend … | |
I got a small program here, I am just trying to return a string value from a function through a reference parameter but I keep getting an error. Any help or tips will be appreciated #include<iostream> using namespace std; int timesTen(int, string&); int main() { int number = 6, product; … | |
| Greetings everybody, I have been develolping a program for isochronous USB communication. In run time, when allocating memory for transfer, libusb_transfer, ENOMEM error arises. I have been looking for a solution for this problem, but I have not come to a conclusion, yet. What might be the reason of this … |
You cannot determine whether a ctor is being called on an object that is to become const. Such as: const Foo bar( another_foo ); // no way to determine in the ctor that bar will be const I'd like some sort of function attribute for copy constructors to determine if … |
The End.