49,756 Topics
![]() | |
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 '<<' … | |
i have written a class to add matrices ,line 51 of the code has problem. debugger is showing segmentation fault there . please suggest the correction. [CODE] #include <iostream> using namespace std; class mat { int row; int column; double **a; public: mat(){} mat(int r,int c) { row = r; … | |
I need to read data from a file into an array of structs. The info is arranged in the file like so... Spear of Extreme Whaling January 1851 Captain Ahab Each member of the array has a name, month, year, and first and last name of creator. This is the … | |
Hi guys, Im pretty dam stuck at the moment on an assignment Im meant to do. Its my last question so everything is pretty laid out, but the question (to me is not useful) so if you could just help me out it'd be much appreciated Ok so what i … | |
Hey, I'm not too sure what the problem is here, I have never had trouble using fscanf before. The following shows the code I use to check the file, and the result. [CODE]while( true ) { int vals_read = fscanf(fileHandle,"%[^;];%s",&name,&pass); if( vals_read == 2 ) { // process the line … | |
I want to make a simple text program based on the game minesweeper that asks for the number of columns and rows, and asks for the number of mines then create the gameboard with the number of mines scattered throughout on standard output. Any help? | |
I've been trying to code an array where its size is dynamically allocated. It's been a while since I've coded and so I was wondering if you guys could give me some help? There's also a randomize function that allocates the array with a random set of numbers (the quantity … | |
Im a fairly fresh programmer, and I often run into problems like most of us. Most of the time I get it solved in 10 minutes by some google power, but this time Im stuck for real (spent the last 4 hours looking around the web). I first ran into … |
The End.