1,426 Posted Topics

Member Avatar for kinge504
Member Avatar for dreday92

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

Member Avatar for NathanOliver
0
105
Member Avatar for venomxxl
Member Avatar for venomxxl
0
121
Member Avatar for kshahnazari

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.

Member Avatar for NathanOliver
0
179
Member Avatar for rajat.sethi93

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.

Member Avatar for rajat.sethi93
0
208
Member Avatar for dadon1991
Member Avatar for lscamaro

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.

Member Avatar for np complete
0
274
Member Avatar for poloblue

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.

Member Avatar for deceptikon
0
197
Member Avatar for Tinnin

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

Member Avatar for NathanOliver
0
233
Member Avatar for sajis997
Member Avatar for np complete

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.

Member Avatar for np complete
1
1K
Member Avatar for ryan.wood.1042032

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 …

Member Avatar for NathanOliver
0
164
Member Avatar for Kryptonitex

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 …

Member Avatar for Kryptonitex
0
227
Member Avatar for TheRazzle
Member Avatar for ncis_sg1

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 …

Member Avatar for ncis_sg1
2
2K
Member Avatar for RonKevin

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 …

Member Avatar for RonKevin
0
341
Member Avatar for Grandiago

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 …

Member Avatar for vinnitro
0
309
Member Avatar for Jsplinter
Member Avatar for soapy.thomas

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 …

Member Avatar for m4ster_r0shi
0
400
Member Avatar for RonKevin

If you want to know about scanf() check this out. http://www.cplusplus.com/reference/clibrary/cstdio/scanf/

Member Avatar for RonKevin
0
177
Member Avatar for princess128

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?

Member Avatar for np complete
0
175
Member Avatar for AngelOfRock

you might want to check this out. http://www.daniweb.com/software-development/cpp/threads/70096/c-books

Member Avatar for np complete
-1
119
Member Avatar for PinoyDev

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.

Member Avatar for Vish0203
0
142
Member Avatar for np complete

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());

Member Avatar for np complete
0
333
Member Avatar for usdblades

@ usdblades - When you use a function do you include the data type of the pramater when you pass the variable?

Member Avatar for NathanOliver
0
119
Member Avatar for phorce

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();`.

Member Avatar for WaltP
0
126
Member Avatar for coolikedat99

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 >> …

Member Avatar for NathanOliver
0
298
Member Avatar for np complete

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

Member Avatar for TrustyTony
0
243
Member Avatar for Rasool Ahmed

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.

Member Avatar for Rasool Ahmed
0
287
Member Avatar for userIT

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.

Member Avatar for userIT
0
184
Member Avatar for henicken

So what do you have so far? We dont give out answers here we help oy uget the answer.

Member Avatar for NathanOliver
-3
51
Member Avatar for im abcd

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

Member Avatar for im abcd
0
424
Member Avatar for Sendy Hipo

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.

Member Avatar for Sendy Hipo
0
175
Member Avatar for Pyler

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 …

Member Avatar for NathanOliver
0
84
Member Avatar for RonKevin

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 …

Member Avatar for RonKevin
0
569
Member Avatar for jonnyc++

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 …

Member Avatar for jonnyc++
0
718
Member Avatar for hcoyle545

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)); …

Member Avatar for phorce
0
277
Member Avatar for ScottFountaine

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?

Member Avatar for ScottFountaine
0
130
Member Avatar for Aghtar

@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.

Member Avatar for NathanOliver
0
134
Member Avatar for Tinnin

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?

Member Avatar for Tinnin
0
116
Member Avatar for Datamaster12

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++

Member Avatar for codecruncher
0
272
Member Avatar for dlmagers
Member Avatar for 9tontruck

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.

Member Avatar for gusano79
0
227
Member Avatar for astala27

Check this out if you are using windows. http://msdn.microsoft.com/en-us/library/windows/desktop/ff468802(v=vs.85).aspx

Member Avatar for NathanOliver
0
351
Member Avatar for godzab

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 …

Member Avatar for deceptikon
0
98
Member Avatar for dlmagers

What do you mean you need an selection structure? Are you talking about a switch statement?

Member Avatar for MasterHacker110
0
226
Member Avatar for txikiting

This might help you out. http://forums.codeguru.com/showthread.php?398243-convert-system-time-as-a-string

Member Avatar for Schol-R-LEA
0
402
Member Avatar for MasterHacker110

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.

Member Avatar for MasterHacker110
0
209
Member Avatar for daino

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 …

Member Avatar for deceptikon
0
345
Member Avatar for JamesArhy

The End.