429 Posted Topics

Member Avatar for tKc

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]

Member Avatar for Agni
0
168
Member Avatar for digan

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.

Member Avatar for digan
0
112
Member Avatar for russjb

Welcome to DW .. Sure you will have a great time here !! Enjoy :)

Member Avatar for AndreRet
0
75
Member Avatar for TinhornAdeniyi

Is your code even compiling? The first error I see is on line 20 where the array size is a non-const integer.

Member Avatar for mitrmkar
0
220
Member Avatar for pspwxp fan

autocar is a pointer but autocar[i-1] refers to a struct and so you should use '.' to access its functions, attributes.

Member Avatar for embooglement
0
136
Member Avatar for EricMack

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 !

Member Avatar for Agni
0
439
Member Avatar for aikiart
Member Avatar for King_Alucard
Member Avatar for Glass_Joe

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 …

Member Avatar for Agni
0
1K
Member Avatar for clb8372
Member Avatar for CanYouHandstand

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 …

Member Avatar for Agni
0
202
Member Avatar for mebob

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 (). …

Member Avatar for mebob
0
272
Member Avatar for Garrett2011

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(){ …

Member Avatar for Garrett2011
0
2K
Member Avatar for kunal kislay

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]

Member Avatar for Agni
0
109
Member Avatar for ThrustinDuffman

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>.

Member Avatar for ThrustinDuffman
0
167
Member Avatar for arsenal_fan

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 …

Member Avatar for arsenal_fan
0
170
Member Avatar for amit12

[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.

Member Avatar for Agni
0
334
Member Avatar for Aia

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

Member Avatar for sureronald
9
625
Member Avatar for mrnutty
Member Avatar for Anyzen

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 …

Member Avatar for Anyzen
0
164
Member Avatar for Agni

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 …

Member Avatar for Agni
0
202
Member Avatar for crapgarden

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 ?

Member Avatar for mike_2000_17
1
147
Member Avatar for maj13205

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.

Member Avatar for maj13205
0
115
Member Avatar for neil_mahaseth

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

Member Avatar for neil_mahaseth
0
144
Member Avatar for Razorfox
Member Avatar for Agni

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 …

Member Avatar for mrnutty
0
653
Member Avatar for PCBrown
Member Avatar for danizobin

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.

Member Avatar for danizobin
0
194
Member Avatar for beaverkill

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.

Member Avatar for n30h4x
0
7K
Member Avatar for Agni

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 …

0
53
Member Avatar for Andreas5

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?

Member Avatar for Andreas5
1
161
Member Avatar for j-green.10
Member Avatar for Lerner
0
93
Member Avatar for tomtetlaw

Works for me (I used a hard-coded file name instead of argument). Do you have the correct permissions on the file and directory?

Member Avatar for tomtetlaw
0
2K
Member Avatar for ghost_from_sa

[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 …

Member Avatar for ghost_from_sa
0
155
Member Avatar for gtateco

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.

Member Avatar for mrnutty
0
3K
Member Avatar for dmr9215

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.

Member Avatar for Radical Edward
0
148
Member Avatar for BLKelsey

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 …

Member Avatar for Agni
0
4K
Member Avatar for eng hassan

[CODE] void breed(int x , int y, char z) { if( board[x][y-1] = ' ' ) set1st(x, y-1, 'X'); } }; [/CODE] using single '=' instead of '==' ?

Member Avatar for eng hassan
0
134
Member Avatar for daviddoria

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 …

Member Avatar for daviddoria
0
398
Member Avatar for yongj

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' …

Member Avatar for Agni
0
97
Member Avatar for sksingh73

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, …

Member Avatar for Agni
0
72
Member Avatar for anuragcoder

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.

Member Avatar for anuragcoder
-1
386
Member Avatar for fougere

[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?

Member Avatar for fougere
0
153
Member Avatar for kourt32

>>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.

Member Avatar for mitrmkar
0
104
Member Avatar for daviddoria

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 …

Member Avatar for Ketsuekiame
0
90
Member Avatar for ARKaMAN

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.

Member Avatar for Ketsuekiame
0
192
Member Avatar for new2programming

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?

Member Avatar for Ketsuekiame
0
161
Member Avatar for newsguy

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.

Member Avatar for Agni
0
582
Member Avatar for evak77

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.

Member Avatar for Agni
0
93
Member Avatar for Agni

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 …

Member Avatar for happygeek
0
79

The End.