51,592 Topics
![]() | |
help me with this problem: to develop a C++ program that generates three random numbers within the range of numbers specified by the user. The program will then determine the largest and the smallest numbers among those three numbers.:'( | |
I can't get this while loop to keep looping and not do a fast loop. The full code is downloadable [CODE]while (num == 0) { cout << "Type in two values:\n"; cin >> num; num1 += num; cin >> num; num2 += num; cout << "Which measurment unit do you … | |
Hi there, Let's say we have the following: [code] #include <map> #include <string> #include <vector> #include <algorithm> using namespace std; typedef pair<string, int> Data; class DataCompare { public: bool operator()(const Data& el1, const Data& el2) const { return lessK(el1.first, el2.first); } bool operator() (const Data& el1, const Data::first_type& k) const … | |
Hello guys i am in level of class and objects i need some help and guide in copy contruct i search the thread and found 1 [url]http://www.daniweb.com/forums/thread21662.html[/url] but this is not what i want... ok here is the problem.. i created contruct class ... i want in program that create … | |
I need help in reading a text file and by using a switch statement the user can either press 1 to find the average of all the integers in the text file, and by pressing 2 they find only the averages of the real numbers in said file. This is … | |
I've build a program with MFC using vc6.0. It consists of a dialogbox and another dialogbox that pops up when you click a button on the first one. And I want to enable TTS on both dialogboxes. Any idea to make sure it works on both? Suppose I use the … | |
I'm new to recursion and am wondering how the output of the code below is 6. So from what I can understand, there are 2 base/anchor cases which return 0 or 1? Is this correct? And the recursive/inductive case is the f() calling f(), but I'm confused on what it … | |
OK, I have a assignment due to use dynamic arrays to make a program that requires user input.It has to be dynamic array, and we never went over vectors in school..as I've seen it used in other not so similar programs, and the result is tabular output like: Canidates Votes … | |
hi is there any body can help us about our project to move the mouse via a webcam who follow a pen. Thanks | |
i need to write a c++ program that calculates and produces these two columns using the three looping statements: for loop/while loop/do while loop. NUMBERS[INDENT][INDENT][INDENT][INDENT]SQUARED[/INDENT][/INDENT][/INDENT][/INDENT] 1[INDENT][INDENT][INDENT][INDENT]2[/INDENT][/INDENT][/INDENT][/INDENT] 2[INDENT][INDENT][INDENT][INDENT]4[/INDENT][/INDENT][/INDENT][/INDENT] 3[INDENT][INDENT][INDENT][INDENT]9[/INDENT][/INDENT][/INDENT][/INDENT] 4[INDENT][INDENT][INDENT][INDENT]16[/INDENT][/INDENT][/INDENT][/INDENT] 5[INDENT][INDENT][INDENT][INDENT]25[/INDENT][/INDENT][/INDENT][/INDENT] kindly help me please..:'( | |
Windows is shutting it down with a send error message option. [CODE]#include <iostream> using namespace std; struct attrib{ char x; int y; char cont; }; attrib brd[8][8]; int main() { for ( int x =-1; x<8; x++) //accesses all columns in the array { for ( int y=-1; y<8; y++) … | |
Hey there im doing a simple two up dos program for an assignment and im having some issues, we have been given a skeleton with methods and forms within it and im pretty sure were not allowed to change it. heres my code: [code] class TwoUp { Coin coin1 = … | |
Here are my questionsand my answers. Could you guys/gals tell me if i am right or wrong? Which array-based operations are O(1)? inserting item or deleting item in unsorted array Which linked-list operations are O(1)? inserting and deleteing item in unsorted lsit Which array-based operations are O(n)? traversing through the … | |
I seem to be getting a segmentation fault in my array. When I run it the the TF and TC appear at the top then the array. That's when the error occurs. I tried debugging it and when tf = 10 the error was occuring. Can someone help plz. #include … | |
A nice short interview/article [URL="http://www.wired.com/thisdayintech/2010/10/1014cplusplus-released"]here[/URL] | |
Hi. How can i find how much windows are running at the same time? For example i need to find how much Calcultators are running. I tried using [iCODE]FindWindow()[/iCODE] but it always returns me same handle. Any ideas? Thank you | |
Hi dear all ! I am programming a windows form application using C++.net(CLR). In my program I am to draw a flow chart or such shapes with undetermined length, so I must scroll the form to enable user to see all parts of the shape. I enabled AutoScroll method of … | |
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 … | |
hi everyone!!! need help here, how can i pass a string to a class? i have two forms and a class, my 1st form is the main form and the other form is used for assigning to a keyer, this form has a combobox where i will select the keyer … | |
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 … | |
Ok, I have a huge program and I ran it today and found that its using 100% of the CPU and bogging down the system to such a degree moving the mouse is an effort - let alone opening a window. I've been trying all day to narrow down the … | |
[CODE] #include <iostream> #include <fstream> using namespace std; int main (int argc, char* argv[]) { int length; char * buffer; string searchWord = argv[2]; string compareStr; int searchSize = searchWord.size(); ifstream readFile; readFile.open (argv[1], ios::in ); ofstream writeFile; writeFile.open("newData.txt", ios::out); readFile.seekg (0, ios::end); length = readFile.tellg(); readFile.seekg (0, ios::beg); buffer … |
The End.