49,761 Topics
| |
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 … | |
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 … | |
I've installed MinGW so I can use it with my eclipse. What I want to know is do I need to install MSYS? | |
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 … | |
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> … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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' … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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] | |
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 … | |
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 … | |
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 … | |
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 … | |
| 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 … |
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 … | |
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 … | |
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 … | |
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 … | |
| 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. … |
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 … | |
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 … | |
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 … |
The End.