2,712 Posted Topics
Re: [QUOTE=neha arora;950099]i wanna know that if a program consists of 10 lines n if we compile it , it shows increased no of lines compiled why:icon_question:[/QUOTE] Why does it matter. I hope you are not worried about the program size at 10 lines. | |
Re: Is that the correct function name ? What is KillALData and where is it declared? | |
Re: Use Euclid formula : [URL="http://en.wikipedia.org/wiki/Pythagorean_triple"]Formula(wiki)[/URL] | |
Re: "This 2 pieces of code is equal" well mostly the initializer list is more optimal than the second way. | |
| |
| |
Re: [code] cout.setf(std::ios_base::fixed,std::ios_base::floatfield); int someNumber = 10; cout.precision( someNumber ); [/code] | |
Re: strcpy(cline, sline.c_str()); chr = strtok(cline,","); data.ticker +=string(chr); You problem is probably there. whats sline.c_str() ? Its not initialized to anything. | |
Re: 1) Try rebuilding it. 2) How did you create this project? | |
Re: Let the string class do all the work. use stringVariable.find() function. Here is an example : [code] bool isAnagram(string& str1, string& str2) { //check for length equality if(str1.length() != str2.length()) return false; if(!str1) return false; //check for string equality if(str1 == str2) return true; for(int i = 0; i < … | |
Re: Just by looking at your errors : You forgot to include proper library. Fastest way is to #include<iostream> using namespace std; Although its not good practice. | |
Re: If you want fixed point then user [code] cout.setf(std::ios_base::fixed,std::ios_base::floatfield); [/code] This will output number such as 1.2000000000 instead of 1.2e10 | |
Re: [QUOTE=Asafe;949369]Hahaha, none of our programs return. [code] int main(){ //return 0; } [/code][/QUOTE] actually, it did, implicitly :) | |
Re: "m*m =i " Lets see , let m = 5, then [code] 5 * 5 = i --------------- 5 * 5 = 0 /// 25 = 0 // = false 5 * 5 = 1;// 25 = 1 // false 5 * 5 = 2;// 25 = 2 // false … | |
Re: for(int i = 0; i <= Flowers; i++){ change that to i < Flowers. Also notice the error : "application wrote to memory after end of heap buffer" It says that you wrote into memory where you were not supposed to. If thats the case, then look in your code … | |
| |
Re: Somewhere you have declared a Item variable in your code. maybe something like this : int Item; | |
Re: Look up linked list in google. Try implementing it that way, and the push and pop should be easy to deal with. | |
Re: [QUOTE=number87;947424]i++ or i+= will not work because the compiler doesnt allow such operations for enum iterations[/QUOTE] what do you mean. Isn't 'i' a int variable declared inside the for loop? | |
Re: Something like this ? Don't know why you would wan't to do this for. [code] for(int i = 0 ; i < 100; i++) { cout<<"Enter a seed value : "; int seed = 0; cin >> seed; while(seed < 0) { cout<<"\nEnter non negative number : "; cin >> … | |
Re: be careful no to have multiple base class. If so then use virtual derivation. | |
Re: Have you though about not starting with c++, as I hear it can be intimidating to beginners. Also "I'm new and already need help", generally, when one is a beginner, thats when help is needed. | |
Re: To convert decimal value to percentage you divide a value by its max attainable value. For interest if user inputs 6 percent, the max percent attainable is 100, so we divide 6 by 100 to get the percentage. Also [code] if (interest <= 0) { cout << "Please enter a … | |
Re: //open a file for for reading and writin ofstream oFile("outputFile.txt"); ifstream iFile("inputFile.txt"); char c; std::string str; while(iFile.get(c)) { str +=c; } //read in data //now write into the output file | |
Re: Look at std::vectors. They are dynamic sized array capable of being 1d,2d,3d , 4d... And used that with openGL, a graphics library for any 2d or 3d or even 4d objects. | |
Re: const unsigned int MAX = 25; BaseClass * pBC[MAX]; Make sure BaseClass has some virtual function if needed. Now you can static bind or dynamic bind. [code] Static Bind : pBC[0] = new BaseClass pBC[1] = new InherietFromBaseClass //and so on Dynamic binding cout<<"1 for baseclass, 2 for InherietFromBaseClass, //and … | |
Re: This might be of help. Much easier way of reversing a string. [code] //note using mathematical notation its [strt,end] and not [strt,end). //strt is included and end is included as well. void reverseRecursivly(string& str,int strt, int end) { if(strt >= end || !str[0]) return; std::swap(str[strt],str[end]); reverseRecursivly(str,strt+1,end-1); } [/code] And also … | |
Can someone help me out. I haven't dealt with pointer function much. Here is the class definition for which it resides, although its only part of it. [code] template<typename Type> class vec2D { private: bool (*drawFunc)(unsigned int ID); unsigned int Col_id; public: //Enables each object member to have its own … | |
Re: also in c++ its ctime and not time.h, for the header. | |
Re: I would help, but I think I just got blind. Seriously, whats part a and b? | |
Re: 1) Implement the person definition. Make sure You have all needed constructor, for it will be used in the derived class. 2) Implement student class but in the constructor you need to pass it the information needed to person class. [code] class person { private : string name; public : … | |
Re: Before I help can you explain what your trying to achieve here: [code] for (j = 0; AlphaSeats [j] <= 59; j++) AlphaSeats[j] = 0; for (j = 0; BravoSeats [j <= 59]; j++) BravoSeats[j] = 0; [/code] | |
Forgive me Admin. Now that I got your attention. I just wanted to say one thing. PLEASE put meaningful titles on your thread. No, [U]Help[/U], [U]Urgent!![/U], I[U] HATE C++[/U], or even worse "[U]UNTITLED[/U]". Instead, put titles, like [U]help creating a recursive add function[/U], or [U]help I don't understand this homework … | |
Re: Forget tutorials. Get a book written by usually a professor who is very educated in his subject, no offense to anyone. I would suggest [U]C++ Primer Plus[/U]. Its an extensive C++ book. Its designed for beginners in mind. Its about 1k pages. It teaches you from beginning till the end(whatever … | |
Re: First you need to read in the data. Have some flags ready. Then you have a string array with data. Now you need to sort it. There are a couple of ways to sort it now. You can google "sorting c++" and you will find ways to sort data. | |
Re: [QUOTE=iamthwee;944413]That's because you're an idiot. You use one or the other. NOT both.[/QUOTE] Hahahahahahahahha.哈哈哈哈哈哈哈哈哈哈哈哈哈哈. 母母母母母母母母母母母. | |
Re: Here is another random generator : [code] int randI( int min , int max) { return (float)rand()/RAND_MAX * (max-min) + min; } [/code] since generating 1 from (float)rand()/RAND_MAX has low odds, thus returning max would be low, so to fix it you can shift the odds by adding 0.1f; so … | |
Re: "4) add 2 nodes sale file and sale item" First I do not know what a sale file is nor a sale item. I do not bother to download your code to see because most here are too lazy to do that, including me. So if you post and show … | |
Re: #include "Employee Class.cpp" There should be no space between the name , it should be #include "EmployeeClass.cpp" | |
Re: "counting occurrences of each letter." Does that mean you count all letters from a to z? In a sentence and display all letters and the number of occurrence? | |
Re: Make an Id grid like so : [code] _______________________________ | a | b | c | d | -------------------------------- | e | f | g | h | -------------------------------- | i | j | k | L | -------------------------------- | m | n | o | p | -------------------------------- [/code] | |
Re: You know creating a terrain from heightmap is not hard. Its actually easy once you understand the concept. | |
Re: use cin.get(). It reads chars including spaces. Try something like this [code] ifstream iFile("sample.txt"); char c; while( iFile.get(c) ) { if(c == ' ') //add to new string else addToTheLastString . } [/code] |
The End.