581 Posted Topics
Re: I think that you can use a pointer and acess member variables using the '->' Operator. And instead of a single delete. in your destructor. I think we can use something like [code] delete [] Pi; [/code] In the Inventory Class destructor. | |
Re: Hey Interesting Questions above. But i was wondering how do i do that polymorphic structs for this question, [QUOTE]Write a Structure named BASE_STRUCT and another structure named DERIVED_STRUCT where DERIVED_STRUCT is a polymorphic object that inherits information from BASE_STRUCT"[/QUOTE] Should we actually write a constructor For Base_struct and then write … | |
Re: Correct me if i am wrong . But after entering the ID isnt it necessary for the program to find the matching case for the user input? I mean there isnt any function in the above program which is searching for a particular id. | |
Re: Just remove "Void" from all of your functions. [code] CCenter::~CCenter(void) { } [/code] change it to [code] CCenter::~CCenter() { } [/code] And try if it works. | |
Re: Does extern "c" work only for C Codes. This is because i read in a book that with extern "c" we can export many codes from Many Languages. | |
Re: Dude just post the code that you have worked on and are having mistakes, We can then help you, Daniweb isnt a homework service. You will need to show some effort. | |
Re: I am not an expert but i am trying to learn . I dont understand something in the program. &rea 's code [code]unsigned int* RegionToArray(System::Drawing::Bitmap^ binaryImage,unsigned int coordinate_x, unsigned int coordinate_y, unsigned int width_rect, unsigned int height_rect){ [/code] [code] coordinate_x=this->coordinate_x; coordinate_y=this->coordinate_y; width_rect=this->width_rect; height_rect=this->height_rect; [/code] Well If the function is a … | |
Re: Try Something Like This. First Considering that your double is named x; [code] int absx=abs(x); double remainder=x-absx; [/code] then use the modulus operator with absx. Something like [code] double answer=absx%some number; [/code] Then Add in your remainder value [code] answer+=remainder; [/code] So you wont loose your decimal points using this. | |
Re: Hey I have never tried what is posted below. But i think it might work out fine if you wish to align. After the ID 01 And then you can give out a fixed length of setw(4); After that when it comes to the NAME part maybe we can give … | |
Re: Well start out writing the program framework. and next you can ask where you need help. | |
Re: Hey Just use the return Statement to Exit. and in the switch statments Add the following. So the program returns a value and ends. [code] case 0: return 0; break; [/code] | |
Re: There are many errors in your code. To start with . All Function Declarations and Global Variables Should not be declared inside main. The have to be declared outside any code block. Secondly , You have different sets of variables. Like in one line you have used. [code] Gross_Pay=; [/code] … | |
Help Me with this code. i JUST installed code::Blocks and am not familiar with the errors , I wanted to know what is going wrong with this? [CODE=CPLUSPLUS] #include <iostream> using namespace std; int f(); class Date{ int d,m,y; static Date default_date; public: void set_default(int dd,int mm,int yy); Date(int,int,int); Date& … | |
Re: You can also use Character Arrays [code] char title[30]; cin.getline(title,30); [/code] This will even take in spaces between words too. | |
Re: You can use a set of function calls for each room. I have changed in some segments of your code and written a function room1(); you can do that for all your six rooms such that the program will run until the game ends. You can however keep a quit … | |
Re: Well , There is another solution which is simple but requires somewhat more code. But it is sure easy. It is quite easy and i think any programmer of minimum experience will be able to conclude it out. So Okay here it goes. [LIST] [*][B][U]Instructions :[/U][/B] [*]Okay First You Need … | |
Re: [code=cpp] #include <iostream> using namespace std; float bursary(int noModsPassed07 ,int noModsReg08) { if (noModsPassed07 = 0) return 0; if (noModsPassed07 >0 && noModsPassed07 <= 2 && noModsReg08 >= 1) return 300; else return (noModsPassed07 + noModsReg08 * 100); } int main() { int noModsPassed07, noModsReg08; float burs; cout << "Enter … | |
Re: Dude Post in some of the code and then be specific in the questioning . This looks like you are trying to get the homework done totally by the members. >>It probably has many if conditions, but how many is the Question?? This basically depends upon the programmer. For example. … | |
Re: [url]http://www.embedded.com/news/embeddedindustry/192501421?cid=RSSfeed_embedded_news&_requestid=245414[/url] I dont know much about Verilog But above is a n article about it. Hope it helps you out. | |
Hi Everyone , I have some doubts which i have encounteered when i was working on a project of mine, 1)I was wondering whether system("sky.exe") could have variables in it. can i use a string in the place of "sky.exe" something like this [code] string s; s="sky.exe"; system(s); [/CODE] 2) … | |
Re: just add [code] Pause(); [/code] into the code where ever you want to stop . And copy and paste the function somewhere outside main(); And it will work fine. | |
Re: Google for books and tutorials. Buy them or take the free one's C++ Will take time but the effort will be worth it :) | |
Re: Other than that you can use this with shorter code. [code] cout<< "Is the user scheduled for work today? (Y/N)"/n; cin>> ScheduledIn; ScheduledIn = toupper(ScheduledIn) while((ScheduledIn !='Y' || ScheduledIn != 'N')) { cout<< "Please enter Either Y OR N"; cout<< "Is the user scheduled for work today? (Y/N)"/n; cin>> ScheduledIn; … | |
Re: [QUOTE=Dannyo329;604592]Hey Everyone. Is there any way to make a sub? For example there's int main(), can I make something else like int menu() and sort of link int main to int menu? I have no idea how to do this.:-/[/QUOTE] Well if you wanna make subs as you call them … | |
Re: You can use a converter to convert the code from c# to c++ but i have seen one which is costly . [url]http://tangiblesoftwaresolutions.com/Product_Details/Instant_CPlusPlus_CSharp_Edition.htm[/url] I just searched it out on the net. But donot have much knowledge about it. | |
Re: Once you get the year. Look if the remainder when divided by 4 is zero. if(yyyy%4=0) { then //code for leap year; } else{ //code for normal years. Secondly. Instead of checking between 1 to 31 . You should check for values between 1 and the number of days. Something … | |
Re: Post down your code. And then we can see what we can do about it | |
Re: Isnt it working with *root=n;// As this is a normal code for pointing to a variable? | |
Re: I dont think you can grow the size of an array in run-time using normal variables. It basically needs vectors to do that. Correct me if i am wrong. | |
Re: Well cin.getline()....... this function needs two inputs. 1 ) Name of the variable and it is taking only char types not strings. . 2 ) How many characters to get. Read More on this over here. [url]http://www.cplusplus.com/reference/iostream/istream/getline.html[/url] | |
Re: >>C[Warning] `displayStatus' initialized and declared `extern' In the header file you donot have any comma's where as in the file display.cpp you have two inputs for the function maybe that is the reason for that. | |
Re: [QUOTE=Salem;604268]It means they're allocated by the compiler when you compile the program, not when you run the program.[/QUOTE] Yes, Consider this example [code] #include <iostream> using namespace std; int main() { int numbers[5];//This is a fixed array of 5 memory slots. cout<< "Enter A Number"; cin >> numbers[0];//Filled Number 1 … | |
Re: The Right hand value over here in [code] patientstruct1= (*patientstructpointer); [/code] Is an error because a the stucture is taking in values from a pointer, which is not allowed. An example program is written below so that it may help you in solving your problem [code=cplusplus] #include <iostream> using namespace … | |
Re: Well do you mean the end of the c++ program or the end of "file.txt" as you have mentioned in the program? | |
Re: Post your original code .. i mean until where you have coded it. | |
Re: Try a search on google on CSS Liquid Layouts. I do not have much idea about that. But it is possible. | |
Re: [QUOTE=sacdpathade;599980]hey , Prabhakar's qoute is right. Let me elaborate this solution for you. I think to calculate nearest point, u should take following approach. Lets assume that you have 3 points (x1,y1)(x2,y2)(x3,y3). Now you have a point (X,Y) from which you have to search nearest point from mentioned 3 points. … | |
Re: Well thats pretty easy. Use the library cctype [CODE]#include <cctype>[/CODE] And then you can use the tolower command. It just is opposite of toupper. [CODE]char c; cin>>c; char d=tolower(c); cout<<d; [/CODE] Then that code takes in a character and converts into lowercase. | |
Re: Well the program firsts calls main(); Then after that, Assigns space for 3 variables. Then takes 2 values into the first two of its variables and then looks at difference=Subtract(a,b); During that it first calls the function Subtract(a,b) And then assigns the output value to the variable difference. But Subtract … | |
Re: As for the compiler. You can use DEV'S C++ compiler. That is a good one and it avoids command line compiling. | |
Re: Secondly . [B]LOETO[/B] I think you should remove [CODE]cin >> number,first,second,third,fourth;[/CODE] Or [CODE]cin >> number>>first>>second>>third>>fourth;[/CODE] And just use the [CODE]cin>>number;[/CODE] As YOU only require to take in one number each time and get the first,second,third and fourth out from the main number. | |
Re: Well ,I guess that we will know better if you even post out the error's. | |
Re: Hey Black Magic i have solved your problem. Well just examine That you have typed this code in [CODE]p1hp -= p2attack;[/CODE] Line 54. Which probarbly doesnt get executed because there are break; statements above it. So You actually need to paste the code in between Line 46 and line 47 … | |
Re: Well I guess if you can define Cool outside main , And as a GLOBAL var is. The problem will be solved. So try defining Cool outside main . or any other function So that it becomes global. Hope that works ;) | |
Re: Well all C-based compilers have to add in the headers with '.h' following them. Later after the formation of c++ the programmers have ruled out the usage of '.h' and added c in the begininning So #include <ctime> or #include <time.h> Refers to a header file with same content in … | |
Re: Try Googleing it out. Or try on WIKIing it out then you will get a good idea abt it. | |
Re: Well if you can compress it up into a .zip file then you can directly post it up on the forum .While replying to the thread ;) | |
Re: Well you have just left in the question but dint post out any code that we could help you with. This forum is not a homework service. [url]http://www.daniweb.com/forums/announcement8-2.html[/url] Read the above page and then ask questions.:) | |
Re: What actually is happening is that. You have created 2 arrays with the same name in two different functions. So in main the values are getting assigned to the values in the array in line 30 ; And the values that are being printed are from the array which is … |
The End.