Create a List of generic list Programming Software Development by tingwong …public int getNumBoxcars(){ return numBoxcars; } public List<Boxcar<?>> getTrain(){ return train; } public void… } public void addCar(Boxcar<?> boxcar, int i){ if(stopped){ boxcar.setMaxItems(i); train.add(boxcar); } } public void … Re: Create a List of generic list Programming Software Development by subramanya.vl …in class proj5 --> train.addCar(new Boxcar<Person>(), 2); //this is… below******** List list=train.getTrain(); Boxcar boxcar=(Boxcar)list.get(0); boxcar.load(new Person("1234"… this System.out.println(boxcar); And here is the output Boxcar [boxcar=[Person [age=21, name… Counting lines in text file in C styled C++ Programming Software Development by codeyy …like: [ICODE] engine 15 engine 40 coach 30 boxcar 52[/ICODE] Now, I am supposed to count …is clearly 4 (two engines, a coach, a boxcar). Please tell me a simple way to do this….in contains engine 15 engine 40 coach 30 boxcar 52 and train2.in contains engine 25 engine … 5 cars engine, 40 m. coach, 30 m. boxcar, 52 m. hopper, 50 m. lowboy, 45 m… Re: Counting lines in text file in C styled C++ Programming Software Development by codeyy …, if train1.in contains engine 15 engine 40 coach 30 boxcar 52 and train2.in contains engine 25 engine 35 lowboy… train contains 5 cars engine, 40 m. coach, 30 m. boxcar, 52 m. hopper, 50 m. lowboy, 45 m. totalling 217… Issues Understand Basic C# Programming Software Development by Manorly … an abstract class that is inherited by the classes tank, boxcar, engine, and caboose. I have to be able to…[/url] The "Engine" "Tank" "Boxcar" and "Caboose" buttons should add a number… I've only created my classes and set the Tank, Boxcar, Engine, and Caboose classes to inherit the abstract class (… Re: Counting lines in text file in C styled C++ Programming Software Development by codeyy … for text files containing stuff like: engine 45 coach 36 boxcar 26 Re: Numpy loadtxt with string data Programming Software Development by Gribouillis …('time', str, 25), ('int_time', int), ('unit', str, 25), ('avg', int), ('boxcar', int), ]) a = numpy.zeros((1,), dtype=timefile_dtype) x = a[0…('time', '|S25'), ('int_time', '<i8'), ('unit', '|S25'), ('avg', '<i8'), ('boxcar', '<i8')] ('hello.txt', 0, 'August', 0, '', 0, '', 0, 0… Embrace the Young Innovators In Our Workforce Community Center by Lisa Hoover … bullet train coming down the path, not a slow-moving boxcar. "The [idea] is based on a very real workforce… Hangman Source Code: C Programming Software Development by Graphix …|askew|axiom|azure|bagpipes|bandwagon|banjo|bayou|bikini|blitz|bookworm|boxcar|boxful|buckaroo|buffalo|buffoon|cobweb|croquet|daiquiri|disavow|duplex|dwarves… Simple String Question Programming Software Development by hughesadam_87 …: USB2E7196 Integration Time (usec): 11000 (USB2E7196) Spectra Averaged: 500 (USB2E7196) Boxcar Smoothing: 0 (USB2E7196) Correct for Electrical Dark: No (USB2E7196) Strobe… Re: Simple String Question Programming Software Development by TrustyTony … Time (usec): 11000 (USB2E7196) Dumped: Spectra Averaged: 500 (USB2E7196) Dumped: Boxcar Smoothing: 0 (USB2E7196) Dumped: Correct for Electrical Dark: No (USB2E7196… Re: Simple String Question Programming Software Development by hughesadam_87 … Time (usec): 11000 (USB2E7196) Dumped: Spectra Averaged: 500 (USB2E7196) Dumped: Boxcar Smoothing: 0 (USB2E7196) Dumped: Correct for Electrical Dark: No (USB2E7196… Numpy loadtxt with string data Programming Software Development by hughesadam_87 …? ('day', int), ('time', str), ('int_time', int), ('unit', str), ('avg', int), ('boxcar', int), ])[/CODE] The output looks like this:' ('avidin_in_water00349.txt', 2012… Re: What music does everyone like? Community Center Geeks' Lounge by ndeniche … and airwaves, as he continues with his side project "boxcar racer"... they have pretty cool songs, like 'i feel… so', or 'there is' (meaning, boxcar racer)... but as much as mark and travis are in… Re: Fantasy "off" Community Center Geeks' Lounge by nrp46e i'm a sucker for the Boxcar children series if i might say so..., :lol: Re: Create a List of generic list Programming Software Development by JamesCherrill @subramanya: This is an exercise in the use of generics. All you have done is to remove the generics from his code. Re: Counting lines in text file in C styled C++ Programming Software Development by Adak In C, you read a text file line by line, using [CODE]fgets(charArrayName, sizeof(charArrayName), filePointerName);[/CODE] Which will automatically insert the whole line of text, into your char array, including the newline (and the end of string char: '\0', after that. (If room allows). [CODE]while((fgets(charArrayName, sizeof(charArrayName), … Re: Counting lines in text file in C styled C++ Programming Software Development by Ancient Dragon If you can't use c++ objects then use FILE* and call fgets() in a loop until end-of-file is reached, counting the number of iterations of the loop. When done, you will have the number of lines in the file. Re: Counting lines in text file in C styled C++ Programming Software Development by Ancient Dragon First you have to write a function for each command you want to support Next, read a line, split the line into its individual words, then call the appropriate function for the verb in the first part of the string. Something like this: [code] string verb; string line; size_t pos = line.find(' '); // find first word verb = line.substr(0,… Re: Counting lines in text file in C styled C++ Programming Software Development by codeyy I wish to add that: From the user input command, I also want to retrieve the filename (e.g. train1.in) and the following number (e.g. 1) and store them as separate variables. Thanks Re: Counting lines in text file in C styled C++ Programming Software Development by Ancient Dragon The easiest way to do that would be to use stringstream class [code] #include <sstirng> #include <string> #include <fstream> // other includes too int main() { std::string line = "shunt train2.in 2"; std::string verb, filename; int num; strgingstream s(line); // now splie the line into its … Re: Counting lines in text file in C styled C++ Programming Software Development by codeyy Hi, Ancient Dragon! Thanks for your input but I am afraid I am not allowed to use any object-oriented programming and can only use the "procedural fragment of C++". In other words, anything that works in C is allowed. From your code, it appears to me that I may be violating the rules. Please correct me if I am mistaken here because I do… Re: Counting lines in text file in C styled C++ Programming Software Development by Ancient Dragon Sounds like you have to write a C program, not a C++ program. In that case I would use strtok() to split the line. [code] #include <stdio.h> #include <string.h> int main() { char line[] = "shunt train2.in 2"; char *verb, *filename, *ptr; int num; verb = strtok(line," "); filename = strtok(… Re: Counting lines in text file in C styled C++ Programming Software Development by codeyy Thanks a lot, Ancient Dragon! Your program worked like a charm and is very helpful.:icon_biggrin: Re: Counting lines in text file in C styled C++ Programming Software Development by WaltP It looks to me like everyone miss this line in your instructions: [QUOTE=codeyy;]train construction commands from standard input (i.e. just use [B][COLOR="Red"]read[/COLOR][/B]).[/QUOTE] Your instructor told you what command to use for input, didn't he? I agree [iCODE]fgets()[/iCODE] is better. Then again, maybe he meant it only as an … Re: Counting lines in text file in C styled C++ Programming Software Development by codeyy [QUOTE=WaltP;1516714]It looks to me like everyone miss this line in your instructions: Your instructor told you what command to use for input, didn't he? I agree [iCODE]fgets()[/iCODE] is better. Then again, maybe he meant it only as an example.[/QUOTE] Sorry for the confusion WaltP. First we have to write main() in pseudocode (and that is why… Re: Counting lines in text file in C styled C++ Programming Software Development by codeyy The first comment "you can include traing.h ... " was given by a student and not an instructor. Re: Counting lines in text file in C styled C++ Programming Software Development by Adak Unfortunately, your post above, is all about your assignment - and not about using C style C++. This is the part of the assignment that you need to work through. It has so many parts to it, with so many constraints, that it's very unlikely anyone will be willing to donate the time necessary to fully understand it. I've read your description of the … Re: Issues Understand Basic C# Programming Software Development by ShadyTyrant Next you should be thinking about the car class. What are the similarity's between all of the objects that inherit from it. What type of property's and/or field's do all these cars share. Also you can then think about what methods will all the cars have in common. Now you look at all the cars individually and think about what makes an Engine … Re: Hangman Source Code: C Programming Software Development by m123anish please can help me to code hangman in *.cpp where a file contain meaning & words + meaning are display words(correct)should be typed mail me| lost_13feathers@yahoo.com