49,761 Topics

Member Avatar for
Member Avatar for Stogie2

I am looking for the correct way to initialize an array data member and why the following code produces the listed error. Thanks... [code] typedef struct tagsX { tagsX(int u, int v): a(u), b(v) {} int a ; int b ; } sX ; typedef struct tagsY { tagsY(sX *p, …

Member Avatar for Stogie2
0
209
Member Avatar for Wakesta

Someone help/direct me to understand where I have made the below errors from the build report? [CODE] #include <iostream> using namespace std; int main() { } void "welcome_screen"() { clrscr(); textcolor(RED); gotoxy(10,10); cout<<"**************** W E L C O M E *********************** "; gotoxy(15,12); cout<<"*** T O M A N C …

Member Avatar for Wakesta
0
205
Member Avatar for merse

Hi everybody, I have a simple mathematical member function of a class: [CODE] struct shell { double mc, ms, r0, v0, a0, w; shell(double mc, double ms, double r0, double v0, double w); double absv(double r) const; }; shell::shell(double mc, double ms, double r0, double v0, double w) { this->mc …

Member Avatar for Narue
0
158
Member Avatar for Howdydoody

Im having some problems with using the vector pushback method through a structure. The push back method works in one part of the code and not the other. Ive been staring at it for hours and testing different things and i cannot get it to pushback in the section of …

Member Avatar for Howdydoody
0
460
Member Avatar for vbx_wx

I'm trying to print all .pdf files from a partition using Boost.Filesystem and Boost.Regex but when I run my program, Visual Studio 2010 gives me an Abort error. Here is my code: [code] path Path = "e:\\"; boost::regex reg("*.pdf"); for(recursive_directory_iterator it(Path); it != recursive_directory_iterator(); ++it) { if(boost::regex_search(it->string(), reg)) { cout …

0
54
Member Avatar for Narue
Member Avatar for stobbz

[code=c] . . string line; vector<string>DataStore; ifstream file; file.open(fileName.c_str()); if (!file.is_open()){ cout<<"Error retrieving file " <<fileName<<endl; } while(getline(file,line)) { getline(file,line); stringstream lineStream(line); string bit; getline(lineStream, bit, ','); getline(lineStream, bit, '\n'); DataStore.push_back(bit); . . [/code] This piece of code takes a CSV and stores its data in a vector. The first …

Member Avatar for stobbz
0
4K
Member Avatar for rannamaa

In Java and c# you can get the total lenght of an array with array.length or simular. Not only the length of the filled elements, I want the length of the total array. Lets say the array is introduced as this. [CODE]string array[100];[/CODE] Maybe its half filled or not it …

Member Avatar for rannamaa
0
115
Member Avatar for rannamaa

I try to get this to work... [CODE] for(int i = 0; i < size; i++){ if(nameList[i] != NULL){ //save name } else cout << "Namelist is full" << endl; } [/CODE] but NULL is not exepted in a situation like this...or...? I want to put in the name in …

Member Avatar for rannamaa
0
116
Member Avatar for retmil

I am having problems with finding a solution to update the quantity and list the menu items: ex: if you select Plain eggs at 1.45 each 3 times and coffee at .50 each 2 times it should output: 3 plain eggs $4.35 2 coffee $1.00 I have the total cost …

Member Avatar for retmil
0
125
Member Avatar for reloadmvp

Create a class Cat with its data members weight & age, each of which defaults to 1. Provide get & set member functions for each data member. Also provide data member functions speak & walk. Both set functions should verify that data members are >0 otherwise set the default value …

Member Avatar for reloadmvp
0
209
Member Avatar for jmcginny5

So I have the code written, and it is compiling fine. But for some reason, when I compile it and it displays the results, the way it displays isn't the way it should be. It is supposed to pull information in from a binary file. Here is the link to …

0
79
Member Avatar for sha11e

I found this function: I would like to use this for my program. [CODE] void gotoxy(int x, int y) { COORD coord; coord.X = x; coord.Y = y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord); } [/CODE] First of all, is the "COORD coord" neccesary? :/ and "GetStdHandle(STD_OUTPUT_HANDLE), coord)" What's this part? What does it …

Member Avatar for sergent
0
9K
Member Avatar for nxt200

I have a project assignment for school... Basically its coming up with a Windows console C++ .EXE well i have spent a few hours developing a Geometry Calculator.. WOuld anyone be willing to test and report some bugs to me?? This is the project download link: https://sourceforge.net/projects/geocalcrobertdu/ People also wanted …

Member Avatar for sfuo
0
129
Member Avatar for IndianaRonaldo

Im looking for some real c++ programming challenge...please post the most difficult you have encountered yourself....thanks in advance....

Member Avatar for mrnutty
0
102
Member Avatar for osirus0830

The program is compiling and I'm not getting any errors, but when I run the program, after I enter the first value, the program just terminates. [CODE]//carstruct.cpp -- Structure with information about cars #include <iostream> using namespace std; struct car {char make[20]; int year;}; int main() { int cars; cout …

Member Avatar for Narue
0
95
Member Avatar for Muhammad Anas

I am trying to create a program that, after inputing a text file, can: 1) Count number of lines in the text file. 2) Count number of words in the file. 3) Count number of characters in the file [B][U]including[/U][/B] white spaces. 4) Count number of characters in the file …

Member Avatar for Narue
0
2K
Member Avatar for Lokril

My program is due today and I'm stuck at work trying to figure this out I have been using the web to get this done. Instructions: Write a program that adds the positive odd numbers you enter from the keyboard while ignoring the even numbers, and stops when a negative …

Member Avatar for Lokril
0
213
Member Avatar for owenransen

Using the stdl::vector class you can use two sorts of iteration over the vector: the .begin and .end way GlifPtrVec_t::iterator Iter ; for (Iter = m_Array.begin() ; Iter != m_Array.end() ; Iter++) { CGlif* pGlif = *Iter ; delete pGlif ; } or one I am more used to: for …

Member Avatar for mike_2000_17
0
158
Member Avatar for dyingatmidnight

I feel like I'm spamming you guys for help lately due to my poor internet search abilities... anyway, back and again with yet another question. I'm wondering if there's a simple way to determine how many numbers are after the decimal place. ie: 100.00 has two vs. 100.0 which has …

Member Avatar for Narue
0
88
Member Avatar for sha11e

I've seen some programs made with ncurses, and I think it would be really cool to use it in my project for school. Problem is, I have no idea how it works and can't seem to find much, if even anything, about it. Can someone maybe help me a bit? …

Member Avatar for L7Sqr
0
78
Member Avatar for apanimesh061

1.[CODE]int _tmain(int argc, _TCHAR* argv[])[/CODE] 2.[CODE]wprintf(L" ----------\n");[/CODE] This is syntax that I get when I make any Win32 Console Application in Visual C++. I cannot understand what are _tmain(), argc, _TCHAR* argv[]. Till now I have been dealing with void main() and int main(). I also want to know what …

Member Avatar for Narue
0
192
Member Avatar for Howdydoody

I have this program and im trying to get the addVertex method to access the list within the class and return the object "Vertex" whenever i use the brackets. Everything works fine but i cant modify the structure now when i use the brackets. I get an error dealing with …

Member Avatar for Howdydoody
0
108
Member Avatar for lochnessmonster

I dont understand how the C/C++ language is portable? 1.) What makes a program compilable on 2 different O/S's? 2.) Doesn't this depend on the O/S manufacturer? How does Microsoft do this? 3.) What determines wether a language is portable or will only work on one operating system?

Member Avatar for JasonHippy
0
468
Member Avatar for maybnxtseasn

Is there ANY EVER reason why i would return an object or variable by reference? to me this doesn't make sense and is very bad.

Member Avatar for Narue
0
158
Member Avatar for maybnxtseasn

i have a question where i should place #includes in a file? Here is what i tend to have example.h #include <iostream> #include <string> example.cpp #include <iostream> #include "example.h" ------------------------------------------------ Is This what i want? example.h #include <iostream> #include <string> example.cpp #include "example.h" What should i strive to achieve? 1.) …

Member Avatar for Narue
0
109
Member Avatar for clickspiker23

I am having trouble on figureing out on how to return more than one value for x and Y. I know you can only have one return statement but i need to return a value for x and y. I am a little lost on how to do this. This …

Member Avatar for JasonHippy
0
139
Member Avatar for Insensus

Hello there forum, After a pretty thorough C++ course I've tried my hands at coding an actual project but have stumbled on a pretty big problem and here I am asking for your help. What I'm trying to make right now is a class which communicates with a gameserver through …

Member Avatar for Insensus
0
146
Member Avatar for KazenoZ

Hello, I've been looking into implementing a simple networking option to a program I'm working on, and have looked around at what my options are. The program is made in Managed C++(.NET), and so far have worked great. Browsing my options, I've found that .NET is also capable of networking, …

Member Avatar for KazenoZ
0
220
Member Avatar for lochnessmonster

log.h [CODE] namespace stuff { class log { .......... friend std::wostream& operator<<( std::wostream& oss, const log& error ); }; } [/CODE] log.cpp [CODE]std::wostream& stuff::operator<<( std::wostream& oss, const stuff::log& error ) { oss << log.m_message; // log.m_message is a std::wstring return oss; } [/CODE] 1>c:\users\oso\documents\visual studio 2010\projects\moduleinjector\moduleinjector\cdllinjection.cpp(147): error C2679: binary '<<' …

Member Avatar for NicAx64
0
130

The End.