49,761 Topics
| |
Hi everyone, I have a 2d array whith 50000 lines and 14 columns, and I have to sum/multiply each value of a column for a fixes numbers, like this: a[1][14] = 0 a[1][14] + 2 = 2 a[2][14] = 2 a[2][14] + 2 = 4 a[3][14] = 5 a[3][14] + … | |
Trying to understand two dimensional vector and was wondering if anyone could help me out on a sorting code for this so that it numbers 0-9 people, gets x number with each of them and then outputs the person (number) ate x pancakes - But in descending or ascending order. … | |
Hi, I have a list of base types which stores multiple derived types. The following code shows a simplified setup. [CODE]#include "Base.h" #include "DerivedA.h" #include "DerivedB.h" #include <iostream> #include <list> void main() { std::list<Base*> base; std::list<Base*> *basePointer = &base; for (int i = 0; i < 10; i++) { basePointer->push_back(new … | |
Hello, for a project on network simulation I need to show graphical representation of the graph.Which library files can I use for the purpose?Should i switch to OpenGL.I know nothing about graphics in C++ right now.Please help. Regards. | |
| Im trying to install the opencv libraries and i tried following the instructions at: [URL="http://blog.cuvilib.com/2011/03/22/how-to-build-opencv-2-2-with-gpu-cuda-on-windows-7/"]http://blog.cuvilib.com/2011/03/22/how-to-build-opencv-2-2-with-gpu-cuda-on-windows-7/[/URL] but Im having problems getting the sample code to compile. When I try: [CODE]#include <iostream> #include <opencv2/opencv.hpp> #include <opencv2/gpu/gpu.hpp> using namespace std; int main() { try { cout<<cv::gpu::getDeviceName(0); } catch(const cv::Exception& ex) { std::cout << … |
[CODE]#include <ctime> #include <cstdlib> bool winner = false; winner = true; srand((unsigned)time(NULL)); comp_choice = rand() % 3; system ("PAUSE"); return 0; } [/CODE] How to transform this idea or this codes to simple codes in IOSTREAM Library | |
I have a main function and I want to call another function inside my main, but it gives me an error like this: error C2601: 'ComputeCentroid' : local function definitions are illegal I know that this is an error because the '{' for my main is still not closed before … | |
First of all, I'm 17 learning C++ on my own! I've been enjoying Daniweb. and I did like to thank the community for that! Thank you all! Here goes my Problem... I have a small program that calculates time between two instances and it worked fine... so I decided to … | |
ok, so i want a program that just says back to the user their input. the users input will be more then one word, so there will be whitespace. when i use string as a class for the input, then it only gives back the FIRST word of the input.... … | |
Ok, so my program complies (not that that means much, haha), but at least I can now SEE that something in my loops isn't right. I need to take my 2-dim array file input of 4 students with 3 quizzes, which looks like this: (the asterisks are whitespace) 10**10**10 *2***0***1 … | |
Hey Everybody, I keep getting these warnings when I compile my program: 19: warning: extra tokens at end of #ifndef directive 19: warning: missing whitespace after the macro name both apply to the same line number, which has nothing to do with the ifndef statement. I tried looking for an … | |
Trying EVERYTHING but I don't know what the *heck* I'm even supposed to try because there shouldn' tbe a *bleeping* PROBLEM. The file is being opened fine, I guess, because I tried changing the file path and then got an error. It's just not reading the DATA. THERE'S NO REASON … | |
Hello all, I am currently in the process of learning C++ for a work term position I am on. After hitting a wall trying to teach myself from books I decided it might be easier to translate some old Java programs from school into C++ to get a better understanding … | |
Hello everyone, i'm having some problem with the following code: [URL="http://pastebin.com/KTKaVje8"]CODE[/URL] inputSouce is an abstract class and the rest are derived from it. The definitions for these are elsewhere. Now, [CODE]inputSource *irSources[4]; irSources[0] = new irSource(); [/CODE] This is giving me errors. i'm using VS2008. [B]error C2466: cannot allocate an … | |
[CODE]// Finals.cpp.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <string> #include <iomanip> using namespace std; // //CLASS DECLARATION SECTION // class EmployeeClass { public: void ImplementCalculations(string EmployeeName, int hours, double wage); void DisplayEmployInformation(void); void Addsomethingup(void); string EmployeeName; int hours , overtime_hours, iTotal_hours, … | |
Sorry if the title is a bit off, I couldn't think of what to call it. I've created projects in VS, and they all run perfectly fine. However, I now just want to create the source files then compile via the command line. I've done this rather easily, but now … | |
Hi there, I've got a question to ask regarding Hamiltonian problem. I'm doing on a simple question below: State equations ODE:- [TEX]dy/dx (t) = x2(t)[/TEX] [TEX]d^2y/dx^2 (t) = -x2(t) + u(t)[/TEX] ....where u is a control. Initial condition [TEX]x1(0)=0[/TEX] and [TEX]x2(0)=0[/TEX]. We try to minimize [TEX]J(u) = \int\limits_0^{10} [y1^2(t) + … | |
Is it difficult to turn games like [URL="http://www.clarendongames.com/product.php?xProd=3&xSec=2"]Perigon[/URL] that have been written in C++ for iPhone into games for PC? | |
Well I don't have any specific question. I've been writing a chess game and can't seem to figuire out what the problem is with it! I tried debugging it for a few hours now and am about to give up altogether and rewrite it. The problem occurs seemingly randomly when … | |
i have two projects on visual studio 2005 one in vc++ & other in vb.net now i want to both programs to work cooperatively acc to me i have following ideas but dont know how to implement them 1 - if i create third project and integrate/merge/combine other two in … | |
I am trying to dump the memory of my c++ app. [code=c++] #include <iostream> #include <fstream> using namespace std; int main () { ofstream myfile; myfile.open ("example.txt"); myfile << "Writing this to a file.\r\n"; myfile.close(); int *p; *p = 25; char b[] = "hello"; int a; for (a=0; a==-1; *(p++)){ … | |
I have 5 programs that works 100% I need to integrate them in one code using this code in the main [CODE] int A; cout<<" Enter Your Choice"; cout<<"1. Algorithm A ."; cout<<"2. Algorithm B ."; cout<<"3. Algorithm C"; cout<<"4. Algorithm D"; cout<<"5. Algorithm E"; cin>> A; if(A==1) { //call … | |
Hey everyone , I have a Mid semester Exam next week and I need to study the basics of programming a C++ programs. can anyone recommend or help me with some basics or link me something which could help me revise things faster and make it easier. i am sturggling … | |
this program does not read display smallest and largest values in order [ICODE]#include<iostream> using namespace std; int main() { int sum; int product; double average; int x,y,z; int largest; int smallest; cout<<" Enter Three Integers of your Choice "<<endl; cout<<" *********************************** "<<endl; cin>> x >> y >> z; cout<<endl; smallest … | |
Hi, I'm programming something for a micro-controller and I need a compiler that can turn c++ into .bin Anybody have any idea where to get one? | |
Firstly, apologies for the lack of commenting, it will be commented when the program works properly (lol), I'm creating a program which creates a test harness for 3 subjects, employees. This will display their name, ID and payrate per hour, it will then calculates the total amount in 37.5hours. Again, … | |
I was working on this program a year ago and wanted to check something on it but I have some errors on it and was wanting to know if someone very knowledgeable and take a look at this and offer me and advice to make it run. I get some … | |
Please help how do i do this program?? i have only two more days before it is due :( Write a program to read data from a large text file. Within the file, the data are arranged in two columns, separated by white space characters, and comprised of a variable … | |
Made a small project to help compare two files that I am testing...but for some reason the line I highlighted isn't working as its supposed to. I originally had [CODE]c1 != c2[/CODE] and then changed it to [CODE]!strcmp(c1, c2)[/CODE] Maybe its a dumb logic bug, but would appreciate some help … | |
Hello All: I searched through the old posts, but could not find an answer as how to read numbers from a sequential text file & calculate the average of the numbers. Do you place the calculation to find the averages outside of the loop to read the text file? If … |
The End.