User Profile
Collapse
-
aemado started a topic Try/Catch/Throw...Can't get data read in right, and stuck in an infinite loop!in CTry/Catch/Throw...Can't get data read in right, and stuck in an infinite loop!
I am trying to read in several lines, each should have exactly 5 pieces of data. I am using try/catch/throw to determine if the data is in the correct format, and trying to use iss to separate the parts. However, this is my first time using both, and I am pretty certain that I am missing something obvious. Firstly, by debugging, I found that the first piece of data is being checked in the second case, giving me errors. I believe I may need to read... -
Perl Split Pattern
I am writing my very first Perl program, and am still lost with how to use split.
I have several lines of data that I want to read in, for example:
333444555 Smith Ana Ms RN
777666555 Jones Tom Mr MD
These data fields have certain restrictions. The first number always must be exactly 9 digits. The second and third can be up to 9 (anything less)..and the 3rd/4th must be exactly 2. There can be more than... -
Quick Question about an Error Message
This function is in a separate .cpp file from my main, where it is called. I am really new to STL, and think that the problem has something to do with the parameter, but I don't know what. Here is my error message:
error LNK2019: unresolved external symbol....
in this function:
...Code:void printS(list<studentdata>::iterator i) { cout<<"\n\tID number\t"<<i->getIDnumber(); -
Try/Catch/Throw in C++
I am really new to the try/catch/throw concept, and can't figure out what is wrong with my code. Any suggestions?
...Code:#include <iostream> using namespace std; string msgZero = "Zero denominator\n"; void inverse(long value, double& answer) { if (value > 0) { answer = 1.0/value; } else { -
Basic Array Problem
I haven't written basic array code in so long, I have forgotten how to do some of it. I have two data files. There is some data that is common to both, and some that is only in the first and not the second. I am reading this data in and storing it in the form of an array. If a user inputs a value, I am trying to determine if it is in one, both, or neither. This is where I am stuck. Here is what I have:
...Code:#include <iostream>
-
I realize that, but as I mentioned before, I am just starting with this, and learning basic commands. We have yet to even start with CSLAB, or actually type commands in anything. Our homework is simply based on the notes he has provided, and we do not have access to the system to work with yet. My only experience is very limited C++. It would certainly be easier if I could just play around with it. Thanks for answering though, I am just trying to...Leave a comment:
-
Unix command question
I am wanting to list the Unix command to list all files (but NOT all data on the files) that are data files (the file name ends with .data) in the GRE50 directory, and put the list in file datafiles in the home directory. GRE50 is a subdirectory of the home directory.
ls GRE50/*.data > ~/datafiles
Does this look right?? Thanks! -
Basic Unix Help
I am just beginning to learn how to use Unix and its commands. Assuming my home directory is named LearnCS, I want to write out the command to count how many files I have in my home directory that end with the extension *.txt with the resultant answer being a single number.
I believe I need to use grep and piping, but I'm not exactly sure...somethin g like:
grep LearnCS *.txt | wc -l
Maybe? Any suggestions... -
Basic Hardware Question
This seems so simple, but I cannot find an exact answer anywhere.
What is the address for the first accessible data in main storage? How many bits does it represent?
Thanks! -
I finally figured out the whole recursive helper concept late last night...and finished everything with Neil during his office hours today. I'm just getting started on my intermediate drivers, but if you need any help with the program, just let me know :)Leave a comment:
-
Binary Tree Calculator
I am writing a program that will evaluate expressions using binary trees. Most of the code has been provided, I just have to write the code for the class functions as listed in the header file. However, I am really new to recursion and trees...and this program uses public functions and private helper functions, which I am completely lost in. Here is the header file:
...Code:struct CTNode { NodeType type; int -
Yes...sort of. I am writing a function in the stack class. This function has two parameters, passed by reference. As you used the example that I am looking for an even....I am looking for a node that meets a criteria of one of the parameters or the criteria of the other parameter. I want to find the first node in which either of these criteria are met. If it is met, I want to remove it from the stack...and therefore return the parameters for output...Leave a comment:
-
Stacks in C++
I am creating a program that takes a specified number of nodes in a stack...from here, certain nodes are to be removed based on criteria within the node. Once these certain nodes are removed, they are to be output to the screen. Then, the remaining nodes are to be output. I have created both push and pop functions, and I also need a "remove" function. The remove function is to remove the top node that meets the criteria, and return its... -
I am very new to this, and don't know what you mean by STL. In the guidelines, I have to sort this data using parallel arrays, and then sort the same data using structs (both of which end up giving the same result). I have gotten the array sort to work, but am having one final problem that I cannot figure out. When I try to sort using the fourth parameter, it simply doesn't work. It runs through the loop once, and sorts the first two, but then stops....Leave a comment:
-
Will the code work the way I have it structured....w ith the if(parameter).. else(parameter) ...layout??
and by swap the others, is this what you mean?
[CODE=cpp] temp = brand[j];
brand[j] = brand[j+1];
brand[j+1] = temp;
temper = memory[j];
memory[j]...Leave a comment:
-
Sorting Arrays and Structs
I am trying to write a program that reads in data from a user-specified file. I have to sort this file two ways, one using parallel arrays and the other using structs. I then have to output the corrected files to the user. Each file contains up to 10 different sets of data, with each set containing four members. Such as this:
Dell 512 1.7 120
HP 1024 1.4 80
Compaq 1024 1.6 100
Toshiba 512 1.8 160
Lenovo...
No activity results to display
Show More
Leave a comment: