2,712 Posted Topics

Member Avatar for neha arora
Re: c++

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

Member Avatar for necrolin
0
91
Member Avatar for fuggles

Is that the correct function name ? What is KillALData and where is it declared?

Member Avatar for fuggles
0
160
Member Avatar for the great
Member Avatar for Salem
0
885
Member Avatar for Yee

"This 2 pieces of code is equal" well mostly the initializer list is more optimal than the second way.

Member Avatar for mrnutty
0
106
Member Avatar for neppy
Member Avatar for cougarclaws
Member Avatar for cougarclaws
0
111
Member Avatar for prodigyaj

[code] cout.setf(std::ios_base::fixed,std::ios_base::floatfield); int someNumber = 10; cout.precision( someNumber ); [/code]

Member Avatar for vmanes
0
124
Member Avatar for imwan

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.

Member Avatar for DdoubleD
0
1K
Member Avatar for cokaznsyco72
Member Avatar for WouterLindenhof
0
149
Member Avatar for gretty

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

Member Avatar for mrnutty
0
519
Member Avatar for adel_elrefaey

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.

Member Avatar for adel_elrefaey
0
738
Member Avatar for kishan4every1
Member Avatar for hollywoood

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

Member Avatar for hollywoood
0
772
Member Avatar for Roguey

[QUOTE=Asafe;949369]Hahaha, none of our programs return. [code] int main(){ //return 0; } [/code][/QUOTE] actually, it did, implicitly :)

Member Avatar for mrnutty
0
447
Member Avatar for chikool

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

Member Avatar for dgr231
0
112
Member Avatar for Vermillion

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 …

Member Avatar for mrnutty
0
1K
Member Avatar for wndsrf1
Member Avatar for Altermisia

Somewhere you have declared a Item variable in your code. maybe something like this : int Item;

Member Avatar for mrnutty
0
97
Member Avatar for poncho4all

Look up linked list in google. Try implementing it that way, and the push and pop should be easy to deal with.

Member Avatar for poncho4all
0
101
Member Avatar for number87

[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?

Member Avatar for wildgoose
0
132
Member Avatar for skiing

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

Member Avatar for mrnutty
0
231
Member Avatar for esesili
Member Avatar for mrnutty
0
164
Member Avatar for Schoorsteen
Member Avatar for Mental1ty

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.

Member Avatar for JameB
0
148
Member Avatar for hollywoood

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 …

Member Avatar for zalezog
0
921
Member Avatar for lotrsimp12345
Member Avatar for muzhe

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

Member Avatar for mrnutty
0
120
Member Avatar for su_candy

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.

Member Avatar for mrnutty
0
91
Member Avatar for Altermisia

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 …

Member Avatar for Altermisia
0
84
Member Avatar for gretty

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 …

Member Avatar for mrnutty
0
202
Member Avatar for mrnutty

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 …

Member Avatar for mrnutty
0
142
Member Avatar for jeezcak3++
Member Avatar for sara9111
Member Avatar for mrnutty
-2
97
Member Avatar for tazboy

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

Member Avatar for Stefano Mtangoo
0
135
Member Avatar for Nogat21
Member Avatar for thiemebr

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]

Member Avatar for Reprise
0
79
Member Avatar for C.c
Member Avatar for mrnutty

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 …

Member Avatar for John A
0
161
Member Avatar for basitchk
Re: c++

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 …

Member Avatar for Stefano Mtangoo
0
83
Member Avatar for rip_snoopy

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.

Member Avatar for VernonDozier
0
114
Member Avatar for licktress

[QUOTE=iamthwee;944413]That's because you're an idiot. You use one or the other. NOT both.[/QUOTE] Hahahahahahahahha.哈哈哈哈哈哈哈哈哈哈哈哈哈哈. 母母母母母母母母母母母.

Member Avatar for Protuberance
0
261
Member Avatar for bernadlosini

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 …

Member Avatar for mrnutty
0
236
Member Avatar for tarekwehbe

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

Member Avatar for mrnutty
0
129
Member Avatar for mandofl

#include "Employee Class.cpp" There should be no space between the name , it should be #include "EmployeeClass.cpp"

Member Avatar for mandofl
0
4K
Member Avatar for Dr Stupid

"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?

Member Avatar for JameB
0
134
Member Avatar for k007
Member Avatar for sieghuirt

Make an Id grid like so : [code] _______________________________ | a | b | c | d | -------------------------------- | e | f | g | h | -------------------------------- | i | j | k | L | -------------------------------- | m | n | o | p | -------------------------------- [/code]

Member Avatar for VernonDozier
0
105
Member Avatar for sacsmia
Member Avatar for Lilith24

You know creating a terrain from heightmap is not hard. Its actually easy once you understand the concept.

Member Avatar for mrnutty
0
125
Member Avatar for tesid2k8

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]

Member Avatar for mrnutty
0
113

The End.