49,761 Topics

Member Avatar for
Member Avatar for Milton Neal

Hi All This is more a discussion than a problem. :) I’m working on a small project that needs to be done in C++. Part of it requires that I maintain an array of file streams so that I can open serveral files at one time, read, write exchange data …

Member Avatar for Narue
0
242
Member Avatar for dboltz03

I'm experiencing a "sequence not ordered" error when this code is executed and I'm not sure why. Any help would be appreciated, thanks. [CODE]void merge_sort(vector<int>& v, int from, int to, vector<int>& a){ if(from == to) return; int mid = (from + to) / 2; merge_sort(v, from, mid, a); merge_sort(v, mid …

Member Avatar for Ancient Dragon
0
76
Member Avatar for glenak

I've installed MinGW so I can use it with my eclipse. What I want to know is do I need to install MSYS?

Member Avatar for Ancient Dragon
0
65
Member Avatar for gavin2010

here is the assignment....im suppost to write 4 functions which are : [code]bool operator==(const T) const; bool operator< (const Frequency) const; template<typename T> vector<Frequency<T> > Distribution(const vector<T>& v); template<typename T> ostream& operator<<(ostream& out, const vector<Frequency<T> >& v);[/code] my code is at the very bottom Write a template function that will …

0
52
Member Avatar for awadojag

I have a text file with a few cars brands and some information for the cars. I want the cars together with the information for the cars to be sorted in alfabetic order. Anyone can help me to get this working? This is my code: [CODE] #include<fstream> #include<iostream> #include<string> #include<conio.h> …

Member Avatar for awadojag
0
105
Member Avatar for Christ1m

I have this following code. It runs. Im trying to implement remove, sort, and find functions in to this program but I do not know how to. I need some ideas. Find - User inputs the song title. If it finds the song title, it will displays the given info …

Member Avatar for Ancient Dragon
0
91
Member Avatar for Eagles36

I was given a header file and the main files i have to create the implementation file for the header file I am issues trying to find out where I went wrong in my for loops. Can you point me in the right direction The header file [CODE]// FILE: sequence1.h …

Member Avatar for Eagles36
0
2K
Member Avatar for yapkm01

This seems to be weird: [code] int main(int argc, char* argv[]) { cout << "function main() .." << '\n'; char ch = 0; double number_value=1.1; cin >> ch; cin.putback(ch); cin >> number_value; cout << "1 .. " << " " << cin.good() << " " << number_value << '\n'; cin …

Member Avatar for Apple4
0
140
Member Avatar for SeanBlack0000

It is to my understanding when inserting a node to a binary search tree, the data element of the new node is compared to the data element of the node that will be the parent. Now that I have a Ternary Search Tree with two data elements and three keys …

Member Avatar for naz arif
0
130
Member Avatar for Izork

So I read the Book topic, but all of those books seem old. Are they too outdated or can they still be used? I'm starting on a GameIT-College next summer (a 3 year education) and after that a 3 year programming education (Datamatiker is the name on danish) Thing is …

Member Avatar for Izork
0
147
Member Avatar for Violet_82

Hi guys, I have a problem with a program: #include <iostream> #include <string> using namespace std ; // Uses a class with "public" member variables, so directly accessible class Student { public : string name ; int reg ; } ; int main( ) { const char NL = '\n' …

Member Avatar for Violet_82
0
127
Member Avatar for Lenny19

Hi, I'm got to input 12 values and find the maximum, minimum and average value, i've done the maximum, but can't do the min or average, i've spent a couple of hours trawling the web and looking over the code but nothing seems to work heres the part of the …

Member Avatar for saeed67
0
1K
Member Avatar for stereomatching

Below is my code [code] void specificity::showText(vector<name_ID> &sacrifice, int die) { cimg::wait(100); unsigned int R = 50 + rand() % 255; unsigned int G = 100 + rand() % 255; unsigned int B = 50 + rand() % 255; unsigned char purple[] = { R,G,B }; img.fill(0).draw_text(width / 2, height …

Member Avatar for stereomatching
0
84
Member Avatar for burcin erek

I want to generate 10 random numbers. but all numbers will be different. so I tried to use bool first make all false. and each generate, assign that argument with bool but someting is wrong. because outcome is not correct. [CODE]#include <cstdlib> #include <iostream> #include <ctime> #include <windows.h> using namespace …

Member Avatar for burcin erek
0
179
Member Avatar for Chalson

I'm using the 'struture' function to key in two type of data. First is the the position of employee, and another 1 is the salary of employee. May sumbody tel me how to get and calculate the total amount of salary from my input ? I need an example code …

Member Avatar for Chalson
0
91
Member Avatar for taquito86

Hi, may I know if there is an easy way to convert a string into lowercase except for certain parts. Input: I HaVe A CaT caLLed "SaLly" AnD DoG called "BeLLY" Output: i have a cat called "SaLly" and dog called "BeLLY" I do not want the stuff inside the …

Member Avatar for gerard4143
0
91
Member Avatar for maremia

hello every one I tried to solve these functions in C++ but I faced some difficulties So is it possible for any one to help me to solve the functions? please try to help me as you can before tomorrow.. Download the file from [URL="http://www.fileden.com/files/2010/6/24/2896152/GENG106-HW1.docx"]here[/URL]

Member Avatar for maremia
0
90
Member Avatar for stvnddich

I have to write a C++ program that finds all the perfect numbers between 1 to 10,000 and print out the factors after the code finds them. I have written the code to find the numbers, but cant seem to wrack my brain on how to make the factors print …

Member Avatar for Kontained
0
710
Member Avatar for eduard77

Hello, I try to solve an equation. I wtrote this code that compiles with no problem but when I run it it gives me no result. Can anyone help me? Thanks[CODE] #include<iostream> #include<cmath> using namespace std; int main() { double a,b,c; cout<<"Introduce a,b,c\n"; cin>>a>>b>>c; if(a=0) if(b=0) if(c=0) { cout<<"The ecuation …

Member Avatar for eduard77
0
95
Member Avatar for ccube921

I wanted every variable in the array to have .x, .y, and .cont, the error occuired on line 11: [CODE]#include <iostream> using namespace std; struct attrib{ char x; int y; char cont; } attrib brd[8][8]; //ERROR WAS HERE int main() { for ( x=-1; X<8; x++) //accesses all columns in …

Member Avatar for Unimportant
0
124
Member Avatar for n0de

Hi, i'm getting only one digit after floating point after conversion from string to float. Have tryed from standart functions to i don't know.. the problems is that conversion whatever it would be (strtod(), stringstream >> float, atof(), don't even rembember all other wacky ways to do that) brings me …

Member Avatar for n0de
0
200
Member Avatar for chudapati09

I need to write a program that changes a Roman Numeral to a numeric value. I've been inputing the roman numeral "CCLXXXVII", expecting it to output "287". Instead I've been getting "7101". Here is my code: [CODE] #include <iostream> #include <string> using namespace std; const int VALUE_I = 1; const …

Member Avatar for chudapati09
0
177
Member Avatar for frogboy77

How do i create a large array in c++? Apologies if this has been answered already but after searching didn't find what i was looking for. i want to create an integer array of size 1500000 i.e int array[1500000] but my compiler wont allow it. I remember seeing something about …

Member Avatar for frogboy77
0
319
Member Avatar for chintan_1671

Hi i have a code which counts no of lines in a code. I want something like it reads a file and counts all lines in a code. Ex: ls cd date ls ls cd cd ls cd ls I want to print output like: ls cd # 2 date …

Member Avatar for chintan_1671
0
150
Member Avatar for chintan_1671

I have created a binary tree. I have a function which counts the odd values from nodes of tree. I am always getting the output as if it is just returning the odd count from node->right. I am loosing the value of node->left count. [code=c] #include <stdio.h> #include <stdlib.h> #include …

Member Avatar for chintan_1671
0
2K
Member Avatar for RobBobSmith

Hello all: I would appreciate some advice on array subscripts. I am having problems passing 2-D arrays to functions I have written. The reason is that some of the arrays are dynamic arrays subscripted as array[i][j], whereas some of them were created in a class I wrote and these are …

Member Avatar for RobBobSmith
0
133
Member Avatar for chudapati09

I have to write a program where the user would input multiple numbers. This is what it could look like. [CODE] 3 29 98 78 88 100 9 70 73 81 [/CODE] The input is never the same, and I just need to access each number one at a time. …

Member Avatar for chudapati09
0
151
Member Avatar for glenak

So far, from what I've learned from the c++ book I'm reading, the [B]int main()[/B] function in a c++ class is kind of like the [B]public static void main(String args[])[/B] method in java. (I'm a java person and I'm new to c++). However, I found out that within my source …

Member Avatar for gerard4143
0
139
Member Avatar for Jsplinter

The following code generates an error when the [code]//vector<int> myVofInt2(n);[/code] line is uncommented. I get: error C2059: syntax error :'constant'. Does anyone know why it treats the declaration/initializations differently when the vector is inside a class? The vector<int> in the main function creates a vector<int> with ten elements, which is …

Member Avatar for Jsplinter
0
173
Member Avatar for rashid85

Please help me to solve these 3 problems: 1- write a program that prompts a user for a file name of an existing file that contains 10 lines of student names. next the program reads the file name reads the contents of the file byte by byte and writes them …

Member Avatar for Fbody
-1
167

The End.