2,045 Posted Topics
Re: [QUOTE=PDB1982;1038539]This is going to sound bad, but can you use the terms from my code please.....I'm not sure what you mean otherwise....I'm not clear on function(double & value).....how would I code it cor the radius portion? [/QUOTE] In this case, since your functions are returning values (radius returns a double … | |
Re: [code] void Person:: setPay(float thePay) { pay = thePayRate; } void Person::setHours(int theHours) { hours = theHoursWorked; } [/code] Have a problem here with those variable names. Also, does your compiler warn you about iostream.h? Should just be [icode] #include <iostream> [/icode] | |
Re: Do your liters to gallons conversion _after_ you've read in the liters. As of now you're doing that calculation on the 6th line with whatever garbage is in memory. (so in other words convert the value down in your function) | |
Re: I think you need to include more headers... no only kidding. First remove that stray [icode] #endif [/icode]. Then put a semicolon after your class declaration. Get rid off all of the header includes except iostream (substitute [icode] cin.getc(); [/icode] for your conio function). If you are using VC++ you … | |
Re: There's another inconsistency when you are trying to dereference your struct members to write to them with cin. First, for multiple accounts you are not using the i value anywhere in your loop. So you need x[i] to dereference your array pointer and then you can just use the dot … | |
Re: you need to call [icode] calculateTotal(heads,tails); [/icode] from main. As it is you don't do anything with it. | |
Re: Have a look at this thread: [url]http://www.daniweb.com/forums/announcement8-2.html[/url] | |
Re: [url]http://www.cprogramming.com/tutorial/references.html[/url] | |
Re: Are you using Visual C++? If so, did you try to run a debug build on the other machine? If so, you need the release build. | |
Re: I found this... Honestly I'm not sure I understand it completely. [url]http://gcc.gnu.org/ml/gcc-help/2008-01/msg00137.html[/url] | |
Re: Scratch... sorry. I think he's right with the while, except use your count variable. You were getting stuck since your for loop wasn't incrementing [icode] itemsOrdered [/icode] but even doing that your count would be off. Go for the while or do{} while(). (when writing this I had missed that … | |
Re: Return angtorad into a variable, so say [icode] double angrad = angtorad(angle,pi); [/icode] You never actually change angle when you run your function. Use your new value in place of angle in your other functions. | |
Re: There's no such thing as subint to my knowledge. Take in the ID as a string, do a substr(0,2), convert that truncated string to an integer (using atoi). There's a slight flaw in your ID scheme though since if the digits are 00-09 the person could be 100 or just … | |
Re: [QUOTE=fadia;1034721]Hello guys.. I have this tutorial that i keep getting errors on no matter what i've tried.. Would someone kindly check it out for me?! Here is the question: [CODE]# include <iostream> # include <string> void read_student_class(struct student_class[], int class_size) { for(int i=0; i<20; i++) { cin>>csclass[i].studentFname >>csclass[i].studentLname >>csclass[i].testscore; relevant_grade(student_class[i].grade); … | |
Re: I think he might mean a situation where you could take in a class name from the user and instantiate a class, so in your example above: [code] string classname; std::cin >> classname; (it's invalid but...) classname * cn = new classname(); [/code] I think for a finite number of … | |
Re: Put a counter in with the (appropriate) if statements you've already defined (when a match happens, register one more on the counter). In the end, output the counter. | |
Re: You should just be able to substitute your ofstream object for the cout directly. See [url]http://www.bgsu.edu/departments/compsci/docs/write.html[/url] | |
Re: Just change ph to an [icode] int[/icode] (it doesn't work because 10-14 aren't chars, they are strings) And you're missing a semicolon after cin.get() and you need to close your switch statement with a brace | |
Re: You're program is trying to get 20 sets of data after 20 different decimal points. I don't think that's what you want. You could move k into your inner while loop to keep track of the total number of digits. | |
Re: This is the best self-contained list I could find: [url]http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier[/url] They seem to cover the ones I remember. | |
Re: With no braces,{}, your while loop is only getting the statement directly underneath it. Start there. You don't want to return a true or false from main as your return type for main is an integer but also doing so will halt your program. Instead, after your if statement, set … | |
Re: [icode] cout << setiosflags(ios::fixed) << setprecision(2); [/icode] Sets the display to fixed precision and then fixes the number of digits after the decimal to 2. Any calls to cout after that will have those properties. Use resetiosflags ([url]http://www.cplusplus.com/reference/iostream/manipulators/resetiosflags/ [/url]) to restore the default settings (it might not reset the 2 … | |
Re: Explain your confusion a little more. Wouldn't you just add up all of the [icode] product[index].sale [/icode] values then prompt the user for a payment amount? | |
Re: Circumference and area are both out of scope in the main() function, and you need to pass in radius to the function. They should probably return floats | |
Re: Firstly, you should be creating it as a Win32 console project. Secondly, [icode] #include <iostream> [/icode], as iostream.h is non-standard. Start with those and it should give you two warnings and an error. The warnings are about using your two time functions with an _s at the end, which makes … | |
Re: [QUOTE=evstevemd;1025684]Hi all, can anyone point me to an offline MINGW installer? [/QUOTE] I've never attempted to install it this way, but check out (scroll down to Manual Installation) [URL="http://www.mingw.org/wiki/HOWTO_Install_the_MinGW_GCC_Compiler_Suite"]http://www.mingw.org/wiki/HOWTO_Install_the_MinGW_GCC_Compiler_Suite[/URL] | |
Re: Well, your [icode] int n; [/icode] is local to that block so it's going to disappear shortly thereafter. A lot of this depends on the specification of your problem. Can you use arrays? You don't have to, and it's more effective without them, but if that helps you understand then … | |
Re: Have your constructor for Gradebook take two parameters, one for the student's name and one for the professors. As you have it, you are setting both the student and professor name to be the name passed in: [code] GradeBook::GradeBook( string name ) { setCourseName(name), setProfessorName(name), displayMessage(); } [/code] should be … | |
Re: Instead of simply counting the periods (dots) in the first if statement, why don't you store the location of the second one and remove it after the for loop exits? Your TextChanged() event will be firing each time you type anyway... | |
Re: I tried a bunch of things but none worked out.... the compiler seems to want a [icode] Node* (*)[MAP_HEIGHT] [/icode] but putting that in explicitly didn't do it | |
Re: Get a secure FTP program (e.g., [url]http://www.coreftp.com/[/url] but there are many others, or if your school doesn't use SSH you could use the insecure one in windows,ftp.exe ) and you should be able to log into your shell account and transfer files. | |
Re: It's not in pdf, but [url]http://www.brpreiss.com/books/opus4/html/book.html[/url] | |
Re: Based on how you've set it up, your vector<int> for each sample will have two members, say V1(0) = 1, and V1(1) = 2, and another would have V2(0) = 2, V2(1) = 3. So you are correct that you would have to calculate a third vector V3(0) = V1(0) … | |
Re: It costs and I've never used it but just to throw it out there: [url]http://www.comeaucomputing.com/[/url] | |
Re: Please use code tags [code] [/code] around your code. [code] double hours; rate; [/code] separate on the same line by a comma: [icode] double hours, rate; [/icode] or if you want do [icode] double hours; double rate;[/icode] [code] rate = calculatecharges(double hours); [/code] don't need to give the variable type … | |
Re: You don't need ; after your #includes You need a return type for your function definition (and you can omit the return) >= and <= are the only valid ways of writing those operators you need to give an array size for xData and yData just follow the errors that … | |
Re: you are assigning your temps TO the record.totalpoints when the temps haven't been assigned any value. also, your temp1,temp2,temp3 are not in scope with the class_avg function. pass them in as arguments. you should only need one while loop, if there is just a set number of records, use a … | |
Re: #include <iostream> not iostream.h (and using namespace std; or preferably using std::cout; using std::cin; ) main should always return an int As it is you are trying to cram your movietype string into a char... pay close attention to your error message, what is it saying your type needs to … | |
Re: iQuickAnswer should be a char. it can technically be an int, but that might mess up your comparisons. also, if you are testing for 'y' you should probably test for 'Y' also (iQuickAnswer == 'y' || iQuickAnswer == 'Y'). the same for 'n' and 'N'. your syntax is laid out … | |
Re: [code] cout << "The selling price of the dress is " << ch << percentage << endl; //Step 6 sellingPrice = price + (1 * percentage); [/code] you should be calculating selling price before you display it (as of now you are saying it sells at the percentage you entered) … | |
![]() | Re: A great place to start (particularly if you're looking for implementation details) is [URL="http://www.x.org/wiki/"]http://www.x.org/wiki/[/URL] There are loads of other sites that can give you specific info on XLib in C++ |
Re: Should be either [CODE]int x = 153; [/CODE] or [CODE]int x; x = 153;[/CODE] if you wanted to declare two different variables on one line you could put: [CODE]int x,y;[/CODE] | |
Re: I'm not sure which thread library you are using, but even without it you are missing an #endif at the end of your header. I'm not sure if that's the main issue. Are there other errors besides the ones you pasted in? | |
I'm having a hard time geting access to properties in the var output of the query (I know I can use foreach on the result that I've got but I'm not sure which elements values I'm accessing). I think my query is just plain wrong, so I'd appreciate some help. … |
The End.