49,761 Topics
| |
Hello, I am having trouble implementing the load function below. It compiles, but I get garbage in the array and 0's in the vector. The reason I created load() was to clean up main(). Do I need to open data.txt in main and then call a function to load the … | |
Hello, I am trying to implement a linked list with an h file that was provided to me, which I cannot change. I have created a simple main() to begin, but I am getting an error on line 40 of the h file that says... "template-id 'operator<< <int>' for 'std::ostream& … | |
I'm trying to code a traversal function for a huffman tree that will generate the code dictionary containing the binary codes for each letter in the tree. Once it hits a leaf node I want to insert the character and a QBitArray into the QMap that I pass in. The … | |
Hello all... again, I'm trying to write a function that will "simulate" the stack. Here's what I have so far... [code=C++] int i = 0; int arraySize; char * stack[100]; void stackPush(char * pushed) { if(i == 100) { cout << "ERROR: Stack overflow!"; } else { stack[i] = pushed; … | |
What I want to do is have a predefined battle function, I can code the function, all I need to know how to do is have the function sitting there, so when I call it, all it takes is one or two variables to set up and go. So every … | |
Hi guys, this is my first week in C++ and was doing some exercises to practice and made a function to calculate primary factors (Still not sure if it works;) Anyway, here is my code : [CODE]#include <iostream> #include <vector> #include <string> using namespace std; int main() { vector<unsigned long … | |
When making overloaded template function is there a difference between template<> or template<type>. For example is there a difference between [CODE] template <class T> void dispm(T array) { cout << "called template<class T> void dispm(string array)"; } template<class T> void dispm(string array) { cout << "called template<class T> void dispm(string … | |
I am trying to delete an element in my vector but my program crashes after each run. The vector is loaded with integers. [CODE] vector<int> vec(30); vec.erase(vec.begin() + 5); [/CODE] Is this the proper way to delete from a vector? | |
[COLOR="red"]can anybod suggest me links for free ebooks where I can find books on C++ programming in linux. I'll be highly thankful.[/COLOR] | |
Hi, so the exercise I am supposed to do is : "If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 … | |
1. Write a program that calculates gross wages for employees. The program should ask the user to enter an employee’s ID, hours worked and hourly pay rate. It should then calculate the gross wage for that employee and store it with this employee’s information into another file. The program should … | |
Question for anyone using KDevelop: Is it possible to have a "workspace" containing multiple projects, like in a MS Visual Studio "solution" (or Code::Blocks or Codelite etc)? | |
Hello, I'm new to C++ with a fair experience in java. I would like to know the difference between [CODE]Ob o* = new Ob();[/CODE] and [CODE]Ob o = new Ob();[/CODE] I know the first allocates a block of memory and creates a pointer which keeps the address of this block. … | |
| Hello, I am trying to use an OCX control in a console application and I have been doing some reading from the following post [URL="http://www.daniweb.com/software-development/cpp/threads/98162/page1"]http://www.daniweb.com/software-development/cpp/threads/98162/page1[/URL] In the following statement [CODE]HRESULT hr = CoCreateInstance(CLSID_Registration, 0, CLSCTX_ALL, IID__Registration, reinterpret_cast<void**>(&preg));[/CODE] hr has the value Class is not licensed for use. I tried registering … |
Ok, I want to read integers from a text file...a large sum of integers. The input is a regular text file, where each line is terminated with an end-of-line character. The file is gonna contain any valid ASCII symbol between 32 and 127. A number of strings ( no negative … | |
Whats wrong here ? Why the code output prints some extra lines? Input:line number=n. Enter number=num.If line=4 and num=2 , the output will be.... 2 4 8 16 My code is.... [CODE]#include<iostream> #include<conio.h> using namespace std; int main() { int n,num,i,j,s=1,m; cin>>n>>num; for(i=1;i<=n;i++) { m=1; while(s<=j){ m=num*m; s++; } cout<<m; … | |
Hello My problem is I am calling a method in my main but this method doesn't have any code written in it, and yet I am getting an output of numbers approximately 10 digits long, and a negative value. For example, in my main I have: [CODE]Date d1(9,20,2011); // Date … | |
guys i just wanted to know that can we study algorithms with out studying discrete maths first? | |
I realize there are many ways to store large numbers in c++ (and by large I mean too large for long doubles), but none of them were really what I was looking for. I don't just need to store large numbers in which case I would use GMP or something, … | |
hallo reader, im having a problem concerning recursion in C++. I ve encountered a problem that requires to find all the subsets of a set of intergers that gives a required sum, meaning.. Enter integers: 16, 3,3,13. Required sum: 19 The prog should output: 16+3=19 13+3+3=19 the maximum size of … | |
[CODE] //a program to assign seats on each flight of the airlines’ only plane (capacity 25 seats) #include <iostream> using std::cout; using std::endl; using std::cin; #include<string> int main() { string Name; string idNumber; const int SEATS = 26; int plane[ SEATS ] = { 0 }, people = 0, economy … | |
[B]Input[/B] The first line contains the number of test cases t (1 ≤ t ≤ 5). Then t test cases follow, each test case consists of a line containing two integers n and k (0 ≤ n ≤ 100000, n < k ≤ 1018). [B]Output[/B] For each test case output … | |
can anyone explain me how to use the inline function in c++ code with example? | |
This is my prompt. Write a program that asks the user how many twin primes the user wants to find, reads in that goal, and then successively examines the numbers starting at 2 to see if the number is a twin prime. The program stops when the specified number of … | |
Good Day, I have troubles with compiling MySQL++ with Visual Studio 2010 Express edition, I've downloaded MySQL Complete Pack and installed Development tools (server, includes etc), downloaded MySQL++ 3.1.0 and runned vc2008 solution with my vc2010 and compressed it for 2010, I've included everything from MySQL folder and MySQL++ install … | |
Running into an issue trying to fill a vector of structs. I am completely stuck. Here the assignment question Using the data file provided on the next page, write the C++ program to implement a vector of structs containing wines, vintage and scores. Create a file names wines.dat using the … | |
For some people it may be difficult to understand what Boolean is.Well, it's a type of algebra. We will be learning about three Boolean operators today-AND,OR,NOT The order for evaluating Boolean operators are as follows:- AND-If you have a code that should be executed if two conditions are true, you … | |
What does this error mean? invalid operands of types `float[20]' and `float[20]' to binary `operator+' I can't use the + operator when adding array elements? This is my code lines, I'm just trying to add the four surrounding values in a [20][20] array of numbers to the element that's in … | |
Hey everybody,it's the c++ creator.I am a beginner at C++,and am getting confused at functions.I am learning from a site called cprogramming.com and this is what they say- [QUOTE]Lesson 4: Functions (Printable Version) Now that you should have learned about variables, loops, and conditional statements it is time to learn … | |
Hi I am engineering student, currently working in image processing. I have big issue in understanding few basic concepts in programming. To be frank I am beginner, so my question will look silly, so please tolerate with me and if anyone can help me it would be much use full … |
The End.