429 Posted Topics
Re: Is it because you don't have {} after the for statements in both the cases? Without the braces only the next line is part of for loop. And you will also need a [code=c++]data << "\n"; [/code] | |
Re: Declare an integer counter at the start of the program, increment it every time you change case, at the end of while loop read the value of the counter. To post code use the code tags [code=c++] [/code]. This will properly indent your code and make it easier to read. | |
| |
Re: Is your code even compiling? The first error I see is on line 20 where the array size is a non-const integer. | |
Re: autocar is a pointer but autocar[i-1] refers to a struct and so you should use '.' to access its functions, attributes. ![]() | |
Re: I think your first link is pointing to some other page and not the one on plancast. Good interview and well time to check out plancast ! | |
Re: Why don't you write some code and test it yourself? | |
Re: I think you're just not closing the while loop started on line 85. | |
Re: This just means that Apple could end up using their devices as some sort of surveillance device and raises a number of privacy issues, one of them being pointed by cscgal above. To be able to distinguish between users they will have to store a lot of information about the … | |
Re: [quote]where are you struck? [/quote] I hope it didnt hurt much :) ... | |
Re: Are you sure that the pointer returned by mimeData(modes) cannot be null? If not then you should probably test for NULL before inserting the pointer into the list. Also whenever you store pointers in a container you have to be careful that you do not in some other part of … | |
Re: I don't exactly know the reason for this error, but few things which you can correct in your code 1. I don't see the header file include in the .cpp file 2. In the definition of prompt_values and disp_point in the .cpp files you have a ';' after the (). … | |
Re: I would do this [code=c++] #include <iostream> class Rect{ public: enum UNIT {CENTIMETER,METER}; Rect(double len,double wid,UNIT unit){ if(unit == CENTIMETER){ length=(len/100); width=(wid/100); } else{ length=len; width=wid; } std::cout << length << ":" << width << std::endl; } //rest of implementation private: double length;//in meters double width;//in meters }; int main(){ … | |
Re: Read this FAQ [URL="http://www.parashift.com/c++-faq-lite/const-correctness.html#faq-18.17"]http://www.parashift.com/c++-faq-lite/const-correctness.html#faq-18.17[/URL] | |
Re: You must have declared a variable as the type vector<string>, return that and change the function prototype to reflect the return value as vector<string>. | |
Re: lol ..@mike you have obviously not given many interviews. I know people are supposed to be using strings and forget about char arrays, pointers, null terminated etc, but that's probably the most sought after questions in an interview and they make you write all sorts of string reversal, copy,strchr, palindromes … | |
Re: [QUOTE=amit12;1282850]one thread try to read from vector and another thread try to delete from vector how to do it[/QUOTE] As a forum policy we do not give code on a platter. If you want help, show some effort, post what you have tried and people will try and guide you. | |
Re: My heart felt condolences to Dave's family and friends .. I couldn't believe the news when I read the newsletter for this month.. I loved reading his posts in the C++ forum and still have his few words of encouragement he sent me for one of the threads... -Chandra | |
Re: I think if you can understand why it is happening you will be able to fix it yourself. If you try and dry run the 2 loops in your mind: iteration 1: outer loop, i = 0 inner loop j = 0 - max compare a[0] (1) with a[j] and … | |
Hi, I'm using istream_iterator to read input from standard i/p and writing it to standard o/p using ostream_iterator. I expected it to print the input to the console when I hit enter and then exit but it loops for next input after printing and so on. [code=c++] #include <iostream> #include … | |
Re: in B and C you when you say inventory[1] , it is a string there is no conversion from string to type iterator. And I'm not too sure what you are trying to accomplish in D by setting iterator to 1 ? | |
Re: You need to link to function.o object file to your code. if you are using g++ you use the -c option to create the .o file and then link the .o's together to create the executable. | |
Re: Have you tried looking at bitwise operators? See if you can use [URL="http://www.cplusplus.com/reference/stl/bitset/"]bitset[/URL] class, representing each position as a bit with 0 representing OFF and 1 representing ON | |
Hi, I have always been a little confused about inline/non-inline virtual functions and got a little more confused when I read this in a book: According to the book the code below will fail to link on many systems(it gave no errors on mine, g++ 4.4.1). The explanation is "Even … | |
Re: This is just awesome !! Thank you for posting this. | |
Re: Derived class functions which have the same name as the base class functions hide the base class functions rather than overloading them. To allow overloading use the 'using' directive. | |
Re: If you have declared classes then it is usually a good idea to use a .h file and separate out the definition and declaration of the class. As far as the error is concerned can you post some code here? the main function and abc.cpp will do. | |
Hi Guys, I'm trying to evaluate the possibility of using Ontology for one of the tasks in an exercise but can't seem to get my head around its usage. I've read quite a few tutorials and the OWL documentation. I think I can create an ontology with some effort but … | |
Re: Use cin.get() instead of system("pause"). It is slow and non-portable. Read this thread for more info [URL="http://www.daniweb.com/forums/post58481.html#post58481"]http://www.daniweb.com/forums/post58481.html#post58481[/URL] Does this code work? | |
Re: Please post what you have tried and we can try and help you solve it. | |
Re: Works for me (I used a hard-coded file name instead of argument). Do you have the correct permissions on the file and directory? | |
![]() | Re: [QUOTE=ghost_from_sa;1241056]Hey guys im having a bit of trouble with bubble sorting an array from a file... [/QUOTE] Not very helpful that line is my dear friend. Mention you should what the exact problem you are facing, what is the output you are getting. And honestly, say i must, most complicated … ![]() |
Re: You are not setting the pointer to NULL you are trying to assign an initialized object of type list to NULL and there is no such assignment operator. | |
Re: did you put cout and tried to confirm if the insert was happening correctly? Once the insert happens it makes no difference if the input was file or array. | |
Re: Looking at your code it appears that different people wrote the .h , .cpp and main file. The functions declared in the .h file are different from the ones defined in the .cpp file, which again are different from the ones called in the main file. Please look carefully, the … | |
Re: [CODE] void breed(int x , int y, char z) { if( board[x][y-1] = ' ' ) set1st(x, y-1, 'X'); } }; [/CODE] using single '=' instead of '==' ? | |
Re: I think the system has one drawback. People who really understand the problem they are facing can usually google and find the answer. Those who don't really know what the issue is will not benefit much from pointing them to a link since no matter how hard we try the … | |
Re: To make it easier for someone to help, please post the compiler error along with the code. Just saying that the compiler says that there is a conversion error is too vague. The only problem I can see be whatever code you have provided is that you have declared 'newPtr' … | |
Re: There are a lot of places where servers behave as clients to other servers. So it is very much possible (though i'm not sure about this quitting thing). For example in case of a web search engine, the web server accepts users query and then send crawlers to other servers, … | |
Re: Why have you mixed cout and printf ? and read [URL="http://www.gidnetwork.com/b-61.html"]here[/URL] why system("pause") is not a good idea. and read Djikstra's paper on why "goto" is harmful. | |
![]() | Re: [QUOTE=fougere;1222725] [CODE]void add_to_array(Cell *cell, Cell ***dest, Cell ***buf, int *dest_s, int *buf_s) { if (*buf_s < *dest_s) { } } [/CODE][/QUOTE] Are you sure the control is going inside this if condition? Can you put some couts and confirm that? ![]() |
Re: >>i know but when i use file.open(filename.top()) it gives a couple of errors because filename is a collection of string and open expects a const char * , try using the c_str() function on the string. | |
Re: It is not all black and white as I see it. Newbies generally do not know where the problem is and constructing a suitable, simple example demonstrating a problem is not easy for them. Secondly, sometimes in their endeavor to simplify things they might actually leave the important details out … | |
Re: If it's only to be run on windows you can use the sleep command. If it has to be portable you will need to try different system calls based on the platform. I'm not aware of a standard way to do this. | |
Re: There is no implementation for the pure virtual function [code=c++]virtual void Cleanup() = 0;[/code] in the child classes of GameState. Probably the function 'Clean' in PlayState and MenuState has to be named Cleanup? | |
Re: Whitfield Diffie is the full name if I'm not mistaken. I've read one of his books , "The Politics of wiretapping and encryption". Very interesting read. | |
Re: Why do you have 2 programs in there (2 mains)? I don't see any Loan array in your code. can you mark the lines where you are printing the loan array? It is a little difficult to read. | |
I'm sorry if i'm posting this again but i just can't find the search forum button. When I tried logging into daniweb it kept redirecting me to the login page everytime, even though the username and password is same and actually filled in by the browser. Finally I chose the … |
The End.