49,761 Topics

Member Avatar for
Member Avatar for powerdink

Hello, I'm attempting to write a function that accepts a vector "list" and it's "size" as arguments and using an iterator, step through the list to find the one with the highest value. For instance, here is the non-iterator function: [code] int winnerIndex(vector<int> list, int size) { int votes = …

Member Avatar for mike_2000_17
0
107
Member Avatar for airerdem

Hi, I assigned the name of the file to string vector. I mean when I print the vector, it seems like cout<< files[0]; It prints file.txt and I want to open the file by using vector. I tried ifstream file ("files[0]"); and ifstream file (files[0]); but they did not work. …

Member Avatar for airerdem
0
92
Member Avatar for btowne2

Hey yall. Trying to teach myself C++ using the book "Programming and Problem Solving With C++" (5th ed.) by: Nell Dale and Chip Weems... and it's no cake walk. I have a new found respect for programmers and programming in general. Anyway, if any of yall can help me figure …

Member Avatar for Narue
0
96
Member Avatar for murnesty

I'm using eclipse C++ helios and mingw compiler... I created a hello world project without modify the original code.. It compile successfully but when i click run, it show terminated test.exe I'm new to use eclipse IDE, so hope to get some helps here.. thanks

Member Avatar for murnesty
0
191
Member Avatar for kumarmpk4u

Hi all, I am working on an application in which a call is made to a DLL. From that dll a dialog has to be displayed. While doing so I was not able to see the dialog. Dialog is not getting displayed. When i checked the code in debug that …

Member Avatar for kumarmpk4u
0
93
Member Avatar for lilbluemonky

The Program has been started but I am having issues finishing the public class in the header and finishing the functions inside the main file. [B]Header File:[/B] [CODE]#ifndef POLYNOMIAL_H #define POLYNOMIAL_H #include <iostream> /** This class implements a polynomial of the form c0 + c1 x + c2 x^2 + …

Member Avatar for raptr_dflo
0
1K
Member Avatar for lochnessmonster

I'm rather confused on when i would use and what the following libraries( of frameworks[not sure what they are] ) would be used by a programmer. If anyone could please give a simple understandable definition i would greatly be appreciated. ATL MFC COM pretty much when would the following be …

Member Avatar for cppgangster
0
2K
Member Avatar for cppgangster
Member Avatar for mrnutty

Time to time I see some common mistakes or even make some my self. I figure I would post some of these, with hopes that people will learn from my and others mistakes. [B]1) Why you no work?[/B] [code] int sum = 0; for(int i = 1; i < MAX; …

Member Avatar for Moschops
0
143
Member Avatar for senergy

Hi, I wanna ask you if there is SIMPLE way to check if file called XXX is in path YYY? I have this Code: [CODE]int GetLocation() { GetName(); string location; location += "C:\\Users\\" + name + "\\Documents\\test.txt"; if(location) return 1; else return 0; } int main() { if(GetLocation() == 1) …

Member Avatar for senergy
0
1K
Member Avatar for misterious

[CODE]#include<iostream.h> #include<conio.h> class student{ //student class // student class attributes // Access specifier is by default private int ID; char * name; public:// public acccess specifier // student class functions/ operations void login(); bool Select(); void read(); }; // end of student class // ******************************************************************** // ******************************************************************** // ******************************************************************** class …

Member Avatar for raptr_dflo
-4
135
Member Avatar for airerdem

Hi everyone, I have a directory that have 100s of txt files. (Folder is Data_Sets_30) I want to open txt files one by one and get values and close the file and open next txt file get values and close the file and continue like that. I started to code …

Member Avatar for raptr_dflo
0
254
Member Avatar for ryamjones

trying to figure out how to work out cin.ignore(100,'\n'); [code] cin>>idnum; while(!cin.eof()) { cin>>code; if(code == 'm' || code == 'M') { } if(code == 'h' || code == 'H') { cin>>hours; if(hours<=forty) { } if (hours > forty) { } } if (code == 'C' || code=='c') { } …

Member Avatar for raptr_dflo
0
152
Member Avatar for Soulstorm

So we were offered a job yesterday, which involved developing a mobile app targeting multiple platforms. They need the code to be as cross-platform as possible, so I think that C++ is the way to go as far as the infrastructure is concerned, and then we write wrappers in other …

Member Avatar for mike_2000_17
0
149
Member Avatar for F.O.G

i need it can some one help me out with it quest -- write a program in c to input any 10 numbers and print how many are even and odd waiting for responce

Member Avatar for LevyDee
-3
122
Member Avatar for arunkumar267

#include<iostream> using namespace std; class polynomial { private: struct p { int degree; float coefficient; p *link; }*head; public: polynomial() { head=NULL; } void getdegree(); void getpolynomial(int d); void display(); void addition(polynomial p1,polynomial p2); }; void polynomial::getdegree() { int degree1; cout<<"\n Enter the highest degree of your polynomial:"; cin>>degree1; getpolynomial(degree1); …

Member Avatar for arunkumar267
0
281
Member Avatar for ztdep

[CODE] void findFacesInMesh() { multimap<indexPair, int> mapface; multimap<indexPair, int> ::iterator it, it2,it3; pair<multimap<indexPair, int> ::iterator,multimap<indexPair, int> ::iterator> rangeit; int ip1, ip2; for(int k=0; k!=cells.size(); k++) { for(int i=0; i< ( cells[k].getNbPoints() ); i++) { if(i== (cells[k].getNbPoints()-1) ){ ip1=cells[k].getListPointsIndex(i) ; ip2=cells[k].getListPointsIndex(0);} else {ip1=cells[k].getListPointsIndex(i); ip2=cells[k].getListPointsIndex(i+1); } mapface.insert( multimap<indexPair, int> ::value_type( indexPair(ip1,ip2), k) …

Member Avatar for ztdep
0
125
Member Avatar for Tweekler

Hey, so I need to calculate and display the mode (most frequently occuring number) from a vector of ints. I already have the vector, and it can have any number of elements in it. So now i need to figure out a way to loop through my vector to figure …

Member Avatar for mrnutty
0
1K
Member Avatar for daino

I'm trying to understand how one might go about building a program with a spreadsheet widget and being able to save the data in that spreadsheet? (Just Conceptually). The basic aim here is to input data on a regular basis using a C++ GUI of some kind and having that …

Member Avatar for raptr_dflo
0
228
Member Avatar for sadsdw

Hello everyone, I have a std::map that includes individual ID and a struct that contains father and mother information, read from a file "ped.txt". This file has the format: ID - FATHER - MOTHER. Some fathers or mothers don't have IDs as individuals. The code bellow is an example to …

Member Avatar for sadsdw
0
771
Member Avatar for allialli

hey. i would really appreciate some help on an assignment i've been struggling with. i am supposed to: Write a calculator program. Each time the program starts, reset the current value to zero. The user will then enter an arithmetic operator (either +, -, * or /) and then a …

Member Avatar for Zulkaif dilawar
0
14K
Member Avatar for Dante2002

Hello all, I have put together an inventory program and having problems getting it to compile and run. I am at my wits end, with it. I'm not sure what it is that I'm missing. Any help would be greatly appreciated. Thanks in advance. [CODE] #include <iostream> #include <string> #include …

Member Avatar for fibbo
0
212
Member Avatar for evaldaskowka

Hello i want to get my computer time using c++ i googled, but i couldnt find anything that suits me... Time code should be able to use this function: if(hours == 10) { do something... } Can you help me? Thank you.

Member Avatar for Ancient Dragon
0
217
Member Avatar for learningcpp

Hi Guys, What is the scope of the exception variables when I catch them by reference. [CODE] try{ throw AnExceptionObect("Exception message"); } catch(AnExceptionObect &exp){ logger << exp.what(); //logger is a dummy object throw; //what will happend now? is it going to be throwen by value? and what if I catch …

Member Avatar for learningcpp
0
199
Member Avatar for xpartmgr

OK, so as C++ is new to me I am confused. Generally I would pass an object using the "ref" keyword and I'd have no issues retaining the information that was changed in my object when I got back to the main. Well C++ is different. I have a class …

Member Avatar for mrnutty
0
126
Member Avatar for massivefermion

I know C++ well and have written some programs in it but when I look at a program's code,I can't understand it.I wanna know is there a place where I can learn to write real world programs?Sth like a C++ certification? thanks

Member Avatar for Ancient Dragon
0
435
Member Avatar for somon

hi everyoen i've a matrix array with some value, i want to shaw each of them in matrix type in my form, how can i do it? can i use DataGrid view for this? and if yes ... what is method..

Member Avatar for Ancient Dragon
0
262
Member Avatar for Tweekler

Hi, I just started a C++ class and I'm already having troubles with some parts. The instructions are as follows: "Create a C++ console applications to compile the following statistics on a list of integers: • minimum value; • maximum value; • median value; • arithmetic mean; • variance (population …

Member Avatar for m4ster_r0shi
0
128
Member Avatar for ag_17

This is a problem in a programming contest but I am stuck at it for the past two days Here is a link to the problem : [URL="http://www.techgig.com/codecontest_detail.php?type=advanced"]http://www.techgig.com/codecontest_detail.php?type=advanced[/URL] [CODE]void DrowningVillage(int gridSize,int villageHeights[][10],int origin[]) { int i=0,j,k=0,x=origin[1],y=origin[0],z=0,output1[100],Heights[10][10]; for(i=0;i<gridSize+2;i++) for(j=0;j<gridSize+2;j++) Heights[i][j]=1000; //For removing garbage values and for later comparisons for(i=0;i<gridSize;i++) for(j=0;j<gridSize;j++) Heights[i+1][j+1]=villageHeights[i][j]; …

Member Avatar for alwaysLearning0
0
151
Member Avatar for dilequeno

I have created a program that reads data from a file and stores it into a vector. The data looks something like the following: 48.698635 -0.000000 0.000019 1.000000 -0.004386 0.002192 // Step 1 48.583797 0.114838 0.100000 1.099997 -0.005061 0.001945 //Step 2 48.457909 0.125888 0.100000 1.199994 -0.005854 0.001883 //Step 3 ect... …

Member Avatar for L7Sqr
0
883

The End.