49,761 Topics
| |
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, … | |
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 … | |
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 … | |
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 … | |
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 … | |
[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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
Im looking for some real c++ programming challenge...please post the most difficult you have encountered yourself....thanks in advance.... | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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? … | |
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 … | |
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 … | |
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? | |
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. | |
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.) … | |
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 … | |
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 … | |
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, … | |
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 '<<' … |
The End.