49,761 Topics

Member Avatar for
Member Avatar for coolbeanbob

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 …

Member Avatar for raptr_dflo
0
178
Member Avatar for coolbeanbob

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& …

Member Avatar for raptr_dflo
0
174
Member Avatar for vdsf

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 …

Member Avatar for raptr_dflo
0
303
Member Avatar for MrAppleseed

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; …

Member Avatar for raptr_dflo
0
107
Member Avatar for valestrom

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 …

Member Avatar for valestrom
0
121
Member Avatar for Grovega

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 …

Member Avatar for Labdabeta
0
224
Member Avatar for ProgrammingGeek

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 …

Member Avatar for mike_2000_17
0
168
Member Avatar for fragtech

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?

Member Avatar for mike_2000_17
0
62
Member Avatar for pdwivedi

[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]

Member Avatar for osamalyduc
-1
122
Member Avatar for Grovega

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 …

Member Avatar for Grovega
0
178
Member Avatar for fsamu2001

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 …

Member Avatar for rina6491
-1
975
Member Avatar for ravenous

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)?

Member Avatar for mike_2000_17
0
435
Member Avatar for webjam

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. …

Member Avatar for NathanOliver
0
124
Member Avatar for nalasimbha

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 …

Member Avatar for nalasimbha
0
734
Member Avatar for XodoX

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 …

Member Avatar for raptr_dflo
0
1K
Member Avatar for Onlineshade

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; …

Member Avatar for gusano79
0
58
Member Avatar for srednakun

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 …

Member Avatar for pavangajula2007
0
233
Member Avatar for a.muqeet khan

guys i just wanted to know that can we study algorithms with out studying discrete maths first?

Member Avatar for Moschops
0
90
Member Avatar for Mahkoe

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, …

Member Avatar for Mahkoe
0
183
Member Avatar for geegoo!

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 …

Member Avatar for now how abt tht
0
428
Member Avatar for clyo cleopas

[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 …

Member Avatar for Schol-R-LEA
0
94
Member Avatar for Onlineshade

[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 …

Member Avatar for Narue
0
135
Member Avatar for ravanan
Member Avatar for tajendra
0
380
Member Avatar for RideFire

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 …

Member Avatar for RideFire
0
2K
Member Avatar for senergy

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 …

Member Avatar for raptr_dflo
0
205
Member Avatar for HelpStudents

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 …

Member Avatar for raptr_dflo
0
204
Member Avatar for cadence441

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 …

Member Avatar for mike_2000_17
0
172
Member Avatar for Trekker182

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 …

Member Avatar for raptr_dflo
0
252
Member Avatar for c++creator

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 …

Member Avatar for frogboy77
0
562
Member Avatar for kumar2884

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 …

Member Avatar for naveenture
0
531

The End.