1,426 Posted Topics
Re: I am not seeing an `#endif` at the end of your Account.h file | |
Re: cin.get returns an istream reference not an int. if you want to get an single character than you would do char ch; cin.get(ch); // now ch has 1 letter from the input stream | |
Re: You probolly can get away with changing line 24 to &b = pb; | |
Re: line 22 tels the compiler to initialize an empty array. Line 28 does not make any sense to me. If you want to increase the element that you find you would use the post increment operator not the pre increment operator. | |
Re: We wouldnt know where to start. Did you try printing out the values before you divide to see where you are dividing by 0 like WlatP suggested? Learning how to debug your code is an important part of becoming a programer. | |
Re: What code do you have so far? | |
Re: Line 17 needs to be inside your if statement in your for loop. The way you have it now it will only add the last factor that you find. | |
Re: And what seems to be the problem? It is asking a lot to give us 600 lines of code and not say what problem you are having with it. | |
Re: Well if you struct is called Student_info then you would use typedef std::vector<Student_info> container_Student_info; The syntax for this is typedef std::vector<type_of_object_you_want_for_the_vector> name | |
| |
Re: You should be able to get rid of lines 64-77. If you just keep track of the smallest difference like you are already doing inside your second for loop you should be okay. | |
Re: What data type are you using for your string? Is it the string type or a char*? It also looks like your code to insert is not complete. What happenes if you want to insert into the middle of the array? How do you get the values into the the … | |
Re: Well you never initialize k before you use it as your array subscript. you never want to use a variable before you initialize it. `void main()` is NOT standard. You have two mains in your program. You should use loops instead of goto statements. Your indentation could be cleaned up … | |
Re: I have not seen a for loop used like for readin a file before. When I read from a file I use a while loop. Try doing something like this and see if it helps. #include <string> #include <fstream> #include <iostream> using namespace std; int main() { string input; ifstream … | |
Re: You should use a do-while loop instead of goto. #include <iostream> #include <conio.h> int main() { int array[100], position, c, n; char ch; bool loopAgain = false do // do instead of A { cout<<"Enter number of elements:"; cin>>n; cout<<"Enter "<<n<< " elements:\n"; for ( c = 0 ; c … | |
Re: Well do you know what the formula for the fibonacci squence is? If not it is Fn = Fn-1 +Fn-2 where F0=0 and F1=1. so to get a fib number you have to take the previous number plus the number before the previous number. Can you see know how the … | |
Re: What happenes if you use an array instead of a vector? | |
Re: To test for valid input you generally want to take the input in as a string and check to see if it satisfies the conditions for the type of input you want. If it does than you convert it to the type you want. So if you want to see … | |
Re: If you want to know about scanf() check this out. http://www.cplusplus.com/reference/clibrary/cstdio/scanf/ | |
Re: Why does everyone skip the [Read this Before Posting](http://www.daniweb.com/software-development/cpp/threads/78223/read-this-before-posting-a-question) sticky before they post thier first post? | |
Re: you might want to check this out. http://www.daniweb.com/software-development/cpp/threads/70096/c-books | |
Re: The expression of a switch statement must be of an integer type. That means you can use a single char but not a char array. | |
Re: If you want to get functions from the user to pass to the program than you might be able to do the following. No guarantee though I am just guessing from the code that you have provided. string input; cout << "Enter Equation: "; getline(cin, input); Symbolic y(input.c_str()); | |
Re: @ usdblades - When you use a function do you include the data type of the pramater when you pass the variable? | |
Re: If you want to know the size of a vector you would use `items.size();`. If you want to know the max amount of elements that you can have in the vector before it is resized than you would use `items.capacity();`. | |
Re: For a case like this you could use something like this to make sure that you are geting the input you want #include <iostream> #include <sstream> #include <string> int main() { std::stringstream ss; std::string input; int number; std::cout << "Please enter a number less than 45 digits: "; std::cin >> … | |
Re: If you want an unsigned 64 bit integer you can use `unsigned long long foo;`. Check this out to see the data types and their ranges. http://msdn.microsoft.com/en-us/library/s3f49ktz%28v=vs.80%29.aspx | |
Re: You can do that but I would ask why you want to do that. ZWhat are you trying to accomplish with this? A char is basically a 1 byte unsigned integer so if you use 'a' than it gets interperted to 97. | |
Re: If you are only setting the valuse of the array to one or zero based on if they are higher or lower than the average than you can just do that. You dont to use an array of all ones or zeros to do that. | |
Re: So what do you have so far? We dont give out answers here we help oy uget the answer. | |
Re: If you want to ouput the answer as a fraction you either need to code it that way or make some sort of rational number class | |
Re: One thing to point out is that I don't see the <string> header being included nor do is see std:: preceding string since you are not using a using statement. | |
Re: The pbroblem is that you are passing the arrays to the function wrong. If you want to pass the arrays it will look like this cout << distance(x, y) << endl; Since your function is set up to take an array you just pass the entier array by using the … | |
Re: You might want to check and see if you are even opening the file. to do that you can use this if(in.fail()) cout << "The file could not be open;" I would put that right after line 6 to make sure the file is open before you try to read … | |
Re: Imagine you have a vector full of pointers to a Polygon type. Now there are many types of polygons and they all derive themselves from Polygon. Some of those derived classes are then turned into base classes for other classes. With virtualization you don’t have to worry about the number … | |
Re: Line 26 is not correct. When you define a function outside the class boady you would do it like this. returnType ClassName::FunctionName(paramaters) { // function boady here } So in your case it would look like this. int sample::term() { return ((2 * b) - (4 * a * c)); … | |
Re: Sounds like you need to redesign how you are getting yourt words from the file and how you are comparing them. Have you ever used the string object? | |
Re: @prglili5994 - If you are having a problem with the code that you have start a new thread and post your code, a description of what it should do, a description of what it is doing, any error messages you are receiving. | |
Re: Tinnin the code you posted actually works? As far as I know with how c++ works line 11 should be an error. You shouldnt be able to create any array on the stack without knowing the size at compile time. What compiler are you using? | |
Re: According to [This Link](http://www.engadget.com/2010/04/08/apples-iphone-lockdown-apps-must-be-written-in-one-of-three-la/) you can use c++ | |
Re: Did you add the icc.c file to the project? This is a header and c file library so you need to include the c file in the project. | |
Re: Check this out if you are using windows. http://msdn.microsoft.com/en-us/library/windows/desktop/ff468802(v=vs.85).aspx | |
Re: That’s not really true. A reference is basically a pointer that the complier takes care of dereferencing for you. References also have limitations as that once they are referenced to and object they will always point to that object. Pointers can be change to point at different things at any … | |
Re: What do you mean you need an selection structure? Are you talking about a switch statement? | |
Re: This might help you out. http://forums.codeguru.com/showthread.php?398243-convert-system-time-as-a-string | |
Re: The previous line from where? The previous line that matched from the file? Where are you getting the first letter from? Are you getting it from the user input or from the line you got from the file? Please elaborate a little more with what needs to be done. | |
Re: If all you are using is the exe file you should be okay. You will still have the issue that the code was compiled for a particular implementation like windows running on an x86 chip. There could also be subtle bugs in your code that don’t show up on your … | |
|
The End.