| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11
Comments:
<0> i.e. that's what it was designed to do....read a line <1> http://www.cplusplus.com/doc/tutorial/files.html <2> hmmm but each line contains two values :) <1> there's an example in the middle of that page <0> and??? <1> a line is ended by an end of line character not whitespace <3> is this pharagraph easy to understand? <3> Subcl***es retain their overridden methods when referred to by supercl*** pointers <3> or references. They lose their uniqueness when cast to a supercl*** object. The loss <3> of overridden methods and subcl*** data is called slicing. <4> calc !tutorial <5> !tutorial = C++ is not the sort of thing you learn (well) from a bunch of second-rate tutorials on the Web. The preferred method is to buy a good book (e.g. Koenig & Moo's "Accelerated C++"), get a good C++ compiler or development environment (e.g. Dev-C++), and practice a lot. You could even take a course at your local community college. <4> beginner_: that's pretty easy, IMHO. <0> beginner_ I think it's written poorly <0> I've never liked the idea of supercl*** and subcl*** <4> It's probably a bit too compact for a beginner. (e.g. the name "slicing" is non-obvious to the beginner)
<2> vawjr if I use getline aren't I going to get one line of a text file <1> yes, thats what you want isnt it? <2> no I have a file that has <2> f 0939 \n m 5852 \n f 9659 ... <3> so actualy it means? <0> SJr|nx__ yes, of course.... but if you KNOW there are two values on each line, then lines aren't all that ijportant <2> the \n are actually new lines <2> vawjr yeah this is a beginning c++ course <2> I know on each line there is a gender and a GPA <1> yes, getline will read f 0939 then return <2> right but then I'd have to manually parse that <2> as opposed to <2> inData >> gender >> gpa; <0> so.... while(instream >> gender >> gpa) {/* do your calculations */} <2> oh <2> hmmmm <2> okay <0> so put the inData >> gender >> gpa <0> inside a while <2> as the conditional <0> yeah <2> wow <2> I hate doing that <0> forget about the peek nonsense <2> but I should learn :P <0> WHY? <0> why would you hate doing that? <3> lol look what it says, =) <2> I'm too much of a newb <2> just like I hate doing <0> no <2> ! something I prefer == FALSE <0> you've been using poor langages <2> lol no you can do that in PHP too <2> and yes probably :) <3> the book says that defining all the functions virtualy is a good idea as a summary <2> you do that with MySQL in PHP <2> and it seems sorta wierd to me <2> I guess I should become more familiar with it. <0> well, do you know the "value" of the expression "inData >> gender >> gpa" ? <2> I ***ume that if the extractions are successful its true, but if they fail then the while loop will break. <0> nope <2> then? <0> the "value" is "inData" <2> then?ah <2> ah <2> and if its EOF <0> operator >> returns a reference to the stream <2> then its false <2> ? <0> it will never be EOF <2> hmmmm <0> it's the STREAM <2> okay so when does the loop actually break? <0> if(somestream) will be true ONLY if the stream is "good()" <2> good() ? <0> somestream.good() <0> not fail() <0> not bad() <2> oh neat <0> nol eof()
<2> somestream.good() = true? <0> **** <0> no <2> lol <2> I'm coming to #math for some vector Calculus in about 40 minutes :P <0> .good() doesn't return something you can ***ign to <2> oh <2> no <2> sorry <6> 'morning ;) <2> that was sloppy <2> I just meant somestream.good() will return true <0> indeed <2> is that correct? <0> if nothing is wrong, yes..but very seldom do you see anyone call it explicitly <2> but if there is no more data in the ifstream, then .good() will return false? <0> no <1> if eof(), fail() or bad() return true then good() returns false otherwise it returns true <0> I told you you wrtie whle (inData >> gender >> gpa) <2> I did <2> write that <0> then why are you worrying about good() ? <2> Hmmmmm <2> for the same reason I don't just e-mail you the ***ignment and get you to do it for me <2> however <2> my Vector Calc <0> I wouldn't have done it anyway <2> lol <2> well thats why I am asking <7> anybody knows where to get codeview?? <8> comtria! <2> If I have a string declared with string FILENAME = "file.txt"; <2> how can I use that to open a file <2> inData.open(FILENAME); <2> errors out. <2> ques4.cpp:26: error: no matching function for call to 'std::basic_ifstream<char, std::char_traits<char> >::open(std::string&)' /usr/lib/gcc/i486-linux-gnu/4.0.3/../../../../include/c++/4.0.3/fstream:495: note: candidates are: void std::basic_ifstream<_CharT, _Traits>::open(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>] <9> there is no constructor for std::string <9> inData.open(FILENAME.c_str()); <0> cn28h yes, interesting oversight on the part of the committee <2> ah cool thanks <0> and why the hell you using all caps for FILENAME <2> because its a const <0> 1) you didn't show it that way <0> and who cares that it's const ? <2> 1) that wasn't relevant to the problem <2> 2) my teacher does cause we have a notation to follow <2> constants are all capitals <0> then write it as ****ing const <0> and youre teacher should be shot <2> I did write it as const <2> const string FILENAME = "file.txt"; <0> you SAID declared with string FILENAME = "file.txt"; <0> that isn't const, I'm sorry <2> as I said the fact that it was constant wasn't relevant at the time, so I dropped it. <9> I thought the all caps was for macros <2> oh <2> hmmmm nope <2> its not my prefered choice of Variable naming but its what we use in the course <0> well, it's an interesting, if misguieded convention <2> constants being all capitals and words seperated by _ is wierd? <0> yes, because constants have a habit if becoming not <0> like when you extend the program to have the user enter the filename <0> or write a loop to process several files <2> well <2> thats our syntax <2> and I'm not about to argue with my professor <2> well not Syntax, sorry convention <0> tsk tsk <0> your professor isn't right all the time you know <2> I'd argue with my VB professor, but I think this guy knows what he is talking about. <2> Right but again this isn't a factual arguement. Its a matter of convention, and as the authoritive body for our cl*** he can define the convention we use, and there is no logical basis to dispute that with. <0> you can point out that constants have a habit of migrating to not <0> then the convention (if beleived) leads to lies <2> I could but one, that would certainly never happen in any of our programs in the cl***. Secondly if he retorts with absolutetly anything I have no where to go from there. Thirdly its argueable that its only poor planning that would result in a change.
Return to
#c++ or Go to some related
logs:
#php fuck lolt #MissKitten ubuntu apache change error_log #chatzone chrooting apache php slackware #london #c++ #AllNiteCafe #linuxhelp
|
|