15,300 Posted Topics
Re: You need to pass those vectors by reference instead of by value to avoid duplicating the vectors and so that the changes will be available to the calling function [icode]vector<int> merge(vector<int>[color=red]&[/color] list1, vector<int>[color=red]&[/color] list2){[/icode] | |
Re: It might help to explain your problem is you show something that illustrates what you want to do, because I have no clue what you want. | |
Re: line 12: never ever use [b]gets()[/b] because it can destroy your program. Use [b]fgets()[/b] instead. line 15: you don't need an array of temp pointers. Just one temp pointer will do. I've always coded the bubble sort like this: Note that the inner loop begins one slot beyond the current … | |
Re: >>if (memory[i].substr(0,4)=="0000") memory is an array of integers which of course don't have methods. [edit]^^^ what Shawn said[/edit] | |
Re: >>My question is ,is it really addres or i am wrong informed and if it addres how to use in Dev-C++?is it possible? Yes, as far as I know, those are the actual memory address. You can not access them directly with any 32-bit compiler unless you write your own … | |
Re: >>ofstream* rgpostrm [BASE_LAYER]; Why do you need to many streams? And why allocate them ? >>What it says for ios::binary | ios:out and ios:out | ios::binary There is no difference between the two. Its like asking what's the difference between 2 times 3 and 3 times 2. | |
Re: why don't you make it easy on yourself and give each one a name like you did [b]Emp1[/b] == use [b]Emp2[/b], [b]Emp3[/b], etc. Then I think you can create a jump table [code] table dw Emp1, Emp2, Emp3 [/code] | |
Re: >>Can anyone get me started with this?? Yes [code] int main() { // your code goes here } [/code] How much do you know about the assignment you were given ? Everything that's in your assignment should be covered somewhere in your textbook. | |
Re: (1) The language specification requires them. (2) they separate initialization, condition, and increment statements. | |
Re: That while statement on line 13 is incorrect because eof() doesn't work like that. Instead, code it something like this [code] string line; while(getline(infile, line) ) { // now split this string into individual parts for the structure } [/code] | |
Re: Well yes its possible, but why would you want to do it? Unless, of course you are passing a pointer to another function. [code] Employee emp; Employee* ptr = &emp; ptr->display(); [/code] | |
Re: The function is doing a case-sensitive search -- maybe the search string is not the same case as the strings in the array. You might to a case insensitive compare by converting both strings to all upper case (or lower case) before performing the comparison. Otherwise I see no reason … | |
Re: >>plsss....anyone help me........ If you would read your text book you could help yourself. | |
Re: Did you make any attempts at all to do your own research, like read some of [URL="http://www.google.com/search?hl=en&q=cpu+scheduling+algorithm&btnG=Google+Search"]these[/URL] google links? Or google for the algorithms you want, such as [URL="http://www.google.com/search?hl=en&q=FCFS&btnG=Google+Search"]these links[/URL]? | |
Re: >>is there a way to know what it is expecting you to type? Not unless you have found some kind of mind reading program or a crystle ball :) There are no functions that can anticipate what you are to type. You will have to type the answer and press … | |
Re: Look on the games board, there are lots of them. tick-tack-toe and hangman are two common ones to write. | |
Re: You may not have to do anything with that file other than rename it with csv extension. If paraview is like Excell then you can specifiy column deliminator, and in your case it is a space. If paraview can not do that, then your program should be fairly simple [code] … | |
Re: Miracle on 34th Street (the original version, not the updated piece of trash). | |
Re: 1. move line 12 up outside the do loop, between lines 8 and 9. Once the string is converted to upper case there is no point in repeating that process. You need to reformat the code to make it easier for us to read and understand. It's great that you … | |
Re: you could use an array of structures [code] struct phrases { char* correct; char* response; }; phrases ph[] = { {"CU","See You\n"}, {":-)", "I'm happy\n"}, // etc }; cout << "Enter phrase>"; cin >> input; for(int i = 0; i < sizeof(ph)/sizeof(ph[0]); ++i) { if(stramp(input, ph[i].correct) == 0) { cout … | |
Re: >>and any other pointers with how I should code the else porition on my operator + The easiest way is to use the [b]mktime[/b] function in time.h. Populate a [b]struct tm[/b] structure with the year, month, and day + days_to_increment, then call mktime() to normalize the data. Upon return the … | |
Re: 1. you can not initialize c-style character arrays like you are trying to do in the class constructor. My suggestion is to declare them as c++ string objects. If you can not do that then to initialize the arrays to empty string just set the first byte to 0, like … | |
Re: >>the program gives me an infinite loop where ? If you don't know where then add some print statements or use your compiler's debugger. And your bubble sort algorithm is wrong because it goes through too may iterations and comparisons. [code] void sortScores( int x[], int size ) { for( … | |
Re: Ma, I'm going to rip off your head and shit down your throat! | |
Re: [URL="http://www.winprog.org/tutorial/"]Here[/URL] is an introductory tutorial -- and you can keep your [b]free[/b] book | |
Re: >>Is there any way to easily change what I have, to what I am supposed to have? Depends on your definition of [b]easily[/b] :) It will require some rewriting of each of those cout lines, but shouldn't been too difficult. Something like below (not compiled or tested) [code] #define PRINT_DOT … | |
Re: [b]TemporaryBalance[/b] needs to be declared as either type float or double because integers do not contain decimal values. line 22: syntax error -- here is correction: [icode]int linearSearch(const int array[],int size, int findnumber)[/icode] lines 11-16: If the account is not already in the array then you have to add one. … | |
Re: try this: It does a case-sensitive comparison, such as "Rudolf" is not the same as "rudolf" [code]#include <iostream> using namespace std; int main() { char input[20]; char correct [] = "Rudolf"; cin >> input; if (strcmp(input, correct) == 0) { cout << " correct"; } else { cout << "incorrect"; … | |
Re: You didn't post the [b]include[/b] file(s) -- you DID include the headers for AnsiString didn't you ????? line 3: remove the semicolon between AnsiString and Line. line 6: you have to declare all functions before they can be used. If the function is not coded before the function in which … | |
Re: Commenting code is very good -- but commenting with wrong information is very very bad. >> // Clears the unused characters from the buffer that function does not do what you said it does. [URL="http://www.cplusplus.com/reference/iostream/ios/clear.html"]The [b]clear[/b] method clears error bits.[/URL] >> Ignores the buffer generated by cin.clear Doesn't do that … | |
Re: Is using '#' to deliniate lines required by the assignment or is it something you dreamed up on your own? [code] while( cin >> name >> street >> city >> state >> zip) { } [/code] | |
Re: >>That code is probably riddled with bugs Yes it is. >>and I'm still half a sleep you should have went to sleep instead of posting that code. Attempting to program while half asleep is not good -- been there and done that (unsuccessfully I might add). [code] const int ARRAYSIZE … | |
Re: Glad to see [URL="http://www.programmingforums.org/thread14645.html"]you are posting this question[/URL] everywhere you can :) | |
Re: [QUOTE=MidiMagic;436176]The sex laws of the Old Testament were designed to prevent STDs. If everyone had been obeying them, there would never have BEEN an AIDS epidemic.[/QUOTE] That might be true only if everyone in the whold wide world new about those sex laws. Since AIDS began in Africa its highly … | |
Re: I don't think there is a general way to do it. A char data type is not large enough to use the method that Salem posted. And my compiler VC++ 2005 Express doesn't allow this either even when I typcast the pointers to unsigned long. [code] int main(int argc, char* … | |
Re: in america a [b]democrat[/b] is a political party, not a type of government. And No, the USA is not a democracy but is a republic. There are no true democracies anywhere in the world. A [b]republican[/b] is also a political party. The terms [b]liberal[/b] and [b]conservative[/b] are also used to … | |
Came across [URL="http://www.jokes2go.com/lists/list14.html"]this[/URL] when researching the answer to another question on c++ board and had to share. Just a couple of them below [quote] May all your teeth fall out except for the one with the toothache! May your daughter's hair grow thick and abundant, all over her face! May … | |
Re: We stole it from UK. The early white settlers brought that tridition with them and we just adopted it as a national holiday. | |
Re: [URL="http://www.gnome.org/~veillard/gamin/index.html"]this maybe[/URL] | |
Re: >>I open the data file 26 times Why ??? Your program is failing to close the file before opening it again. >>I need to traspose the data What do you mean by that? to make columns rows and rows columns ? | |
Re: what do you think the answer is? If you have 30 apples and I give you 20 more then how many apples will you have? The answer is that simple. | |
Re: >>CHARACTER ST1*10 probably [icode]char st1[10];[/icode] >>CHARACTER ST*(*) My guess is [icode]char *st;[/icode] | |
Re: >>Would anybody know a way to repeat a program use a loop [code] while( not done ) { // display menu // get input // if 'Q' entered then exit the loop // do something } [/code] Not sure what you are trying to do that that code you posted. … | |
Re: after line 86 you need to actually read a line from the file -- you can't just simply ignore it. [code] string line; for(i = 0; i < 6; ++i) { getline(infile,line); if( i > 1) { // convert to number, you can use stringstream class to do that. } … | |
Re: what have you tried? The logical query would be [icode]where a = condition1 and b = condition2 and e <= something[/icode] but since we don't know what condition1 and condition2 are we can't give much more help. So post your actual code if you want better help. | |
Re: Hope this helps. >>repetition [code] int main() { while(true) // start of loop { // repeat code goes here } // end of loop } [/code] >>no user defined functions Just a function you write yourself. Call it anything you wish except [b]main[/b] [code] int userDefinedFunction() { cout << "This … | |
Re: line 13 -- you forgot the semicolon at the end. line 15: need to escape the '' character [icode]djout.open("C:\\TEST.txt");[/icode] I'm not going to tell you the rest of the errors. Just fix them one at a time and compile after each correction. | |
The End.