49,761 Topics
| |
Now I HAve Written The following Programs [CODE] # include <iostream> # include <string> # define MAXSIZE = 300 using namespace std; bool findTitlePrice(string allTitles[300], double allPrices [300],int totalRec,string title,double price); string allTitles[300] = { "Book 1", "Book 2"}; double allPrices[300] = { 78.5, 66. }; int main () { … | |
Hello, I am having some trouble figuring out an assignment I was given in class. I am not looking for any code, but need a better explanation that what the teacher has given. Basically the program will calculate the number of days between any two days from 1/1/1900 through 12/31/2099, … | |
could somebody tell wats wrong with this #define FOR(x,n)for(typeof(x);x<n;x++) | |
[CODE=c++] class A { int num; public: A() {} A(int _num) : num(_num) {} A operator + (const A & ob) { return (num+ ob.num); } }; int main() { A ob1(1); A ob2(2); A ob3(3); A ob4=ob1+ob2+ob3; } My doubt is in ob1+ob2+ob3 . First ob1+ob2 is evaluated and … | |
I am making a jump and run game- i want my sprites to collect items that are worth points. I want these items to be randomly generated on my tile map. Does anyone know how i can do this? I am using Visual C++ with SDL | |
Hey guys, I am having a problem with this program. It's actually part of an example from Michael Dawson's [I]Beginning c++ Game Programming[/I] This program pretty much randomized a number between 1 and 100 and has the user input his/her guess. The user can deduce what the number is each … | |
I am new new in OOP stuff.I have read the Herbert Schildt's C++ reference.But it just gave me the idea, about how it work.Not how to make it work. I am read few chapters from "Object-Oriented Programming in C++ by Robert Lafore"(old edition featuring UML 1, i guess).But it was … | |
Hello, I have a derived class, that I'm trying to delete. This causes a segmentation error, though. I'm fully aware of the virtual destructor thang, but I'm using it all the way around, and still this issue occurs. I'll post my headers only, please tell if more is required. DataStream.h … | |
Hi All, I have written reversible link list and pasting the code as below in c++. It works fine, please let me know if there are anything more that is required to make this more robust. This is on a single link list. [CODE] [COLOR="Green"] #include "stdafx.h" #include <iostream> using … | |
Hello I am having some problem, can any body give me a helping hand each time I compile I get this error massage, I dont know where I made the mistake help please I new to programming[code]This is my Main File include libraries #include <iostream> //Call C++ normal imput and … | |
hi all i have an assignment in which i have to use object-oriented programming to read from an input file(say: input.txt), use prim's algorithm and calculate the weight of a minimun spanning tree and then save the output to a file(output.txt). the problem with my code is that the program … | |
Hello I am trying to compile my project in VC++ Express Edition and get the error below. The project did compile fine before I reinstalled XP windows. But now when I have installed everything again, I receive this error. I dont understand what this can mean ? When clicking the … | |
Been working on this for hours now. but most of it has been trying to fix these two errors. I've been googling my heart out and keep getting cryptic answers about the [B]const[/B]. Really need help. it's supposed to take in names of students and their scores, sort them, then … | |
i have this code which input 3 numbers into ascending order. i know make it 10 i just change the array size but then it is only ascending the numbers that were inputing that are under 10. how can i change it so it's any number. [code]#include <iostream> #include <conio.h> … | |
Hi All, I'm trying to figure out how to load images from a resource file into a picture box using a visual studio windows forms application in c++. I figured out two different ways to do this in c# by going through the forums, but I cannot figure it out … | |
Hello everyone I know that one cannot pass a parameter to destructor functions in classes. Is there a reason why this functionality was left out of c++, and is there a way to get around it? Thanks! | |
I am trying to write a function which converts a number to a string. But when I return from the function, the reviving string - according to debug mode - still is empty, so the program outputs nothing. What am I doing wrong? [CODE=c] #include <iostream> #include <string> using namespace … | |
Say I have an array like this: double *a; and I use new/delete[] to do memory allocation on it. How would I be able to delete certain elements from it? Like this: [code=c++] void RemoveElement(double *a, const double &element) { } [/code] | |
Hello, I'm writing a simple program implementing a list. You can add, remove, search, print and find the minimum element. My problem is that the program crashes if I don't add the 'system("PAUSE");' line before the last 'printf("Minimo = %d.\n", minimo(l));' call in the main method. Here is the code: … | |
Hi there everybody, I am currently studying for my university exams and need 2 make a function for the below scenario. The function must display the information inside the 2D array as you can see in my code I have tried but to no prevail. Any help will be GREATLY … | |
I am in a bit of trouble with this code it is due tomorrow need pointers the menu is displaying correctly but when i enter a number it locks up have i declared the switch statement wrong or is my menu declared incorrectly also in regards to case 4 it … | |
i have this code here which inputs the numbers and then adds them. is there a cheats way i can change it so that it inputs the numbers then puts them into ascending order. [CODE]#include <iostream.h> void getNumber(int &, int); void sum( int, int &); void output(int[ ], int, int); … | |
I have NEVER had this experience before while coding my past assignments. For some reason, I keep getting this error that says [CODE]error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup[/CODE]. I looked it up on google and people have been saying it's because I should've created a windows … | |
I am wanting to add the most simpelist count down timer available for Visual C++ with SDL. Does any one know of a good one i could try and use | |
[CODE]#include<iostream.h> #include<iomanip.h> using namespace std; float number1, number2, number3; void readThreeNumbers(number1, number2, number3); void sortThreeNumbers(number1, number2, number3); void displayNumbers(number1, number2, number3); int main () { readThreeNumbers(number1, number2, number3); sortThreeNumbers(number1, number2, number3); displayNumbers(number1, number2, number3); } void readThreeNumbers(number1, number2, number3) { cout << "Please enter three floating-point numbers, space between them: … | |
I have a problem with strncpy. I need to change the first parameter to char for it to compile. I am not sure how I should do it. In C# I can just [CODE]int v1 = 123456; string v2 = ""; v2 = v1.ToString(); // in C# this turns the … | |
I've seen a few posts on here talking about "databases" as if they were just files and using fstream to manipulate the file pointer, etc. I'm familiar with SQL, so it would be nice to simply be able to execute sql command (as can be done from vb.net) such as: … | |
i want to read the PDF text through c++ program ,give the solution. | |
Hi , i write this code and i get error whene i run it !!! why i cant send a variable to array parameter ??? [CODE]#include <iostream> #include <conio.h> using namespace std; void main(){ int a,b,c; cin>>a; cin>>b; c = a+b; int array[c]; cout<<c; _getch(); }[/CODE] i get this errors … | |
Hello there, I am trying to figure out the advantages of C++ STL containers over C. Correct me if I am wrong. a)in C++ containers classes are standardized. C doesn't have any standardized libraries for data structures beyond the native array type. b)each of these containers in C++ has member … |
The End.