1,171 Posted Topics

Member Avatar for csayantan

[B]>how to compile c++ program when we r using two different functions which are defined in different file(s) under same directory in linux gcc???[/B] First look at Sky Diploma's post. Second: Well, I would type: [ICODE][B]g++[/B] -o [I]outputfile[/I] [I]file1.cpp[/I] [ [I]file2.cpp[/I] ] [ file[I]x[/I].cpp ][/ICODE] The square brackets indicate an …

Member Avatar for Tom Gunn
0
189
Member Avatar for chrishtones

Well, you could try using the derived maths functions: [LIST] [*][TEX]\sin^{-1}x = atan(\frac{x}{\sqrt{1-x^{2}}})[/TEX] [*][TEX]\cos^{-1}x = 2 * atan(1) - atan(\frac{x}{\sqrt{1-x^{2}}})[/TEX] [/LIST] :) Edit:: Sorry jephthah, I didn't read your post carefully :(

Member Avatar for tux4life
-1
184
Member Avatar for DimOK

[CODE] #include "fstream" #include "iostream" [/CODE] has to be: [CODE] #include <fstream> #include <iostream> [/CODE] Edit:: Why are you using a preprocessor macro? [B]typedef[/B] would be a more accepted way :) Edit:: OP edited/clarified his post, so I removed some things from mine as well :P

Member Avatar for DimOK
1
266
Member Avatar for shamiliroy

Hey shamiliroy, did you notice the following sentence just below your first post of this thread: [QUOTE] Last edited by ~s.o.s~ : 17 Hours Ago at 18:49. Reason: Added code tags, learn to use them. [/QUOTE] I want to felicitate you that you've at least tried to use code tags …

Member Avatar for tux4life
0
98
Member Avatar for Himani_29

[QUOTE=Himani_29;912565]i very well knw tht.. n first plz if u cn stp being tht rude.. i hv been successful in making the code tht helps me do the complete task bt for a single file... nw hw do i manage to gt all the files n do the searches..??[/QUOTE] He …

Member Avatar for Himani_29
0
210
Member Avatar for catchmrbharath

[B]>I wrote a code to get factorial for a number uptil 100.[/B] If you even can't print out the result, how can you be sure then that your code is working?

Member Avatar for siddhant3s
0
102
Member Avatar for kingben

[B]>I also want to read from the passwords file and check if the password has been already generated...... If yes, then generate a new password .....[/B] Well, you could for example at the start of the program, read out all the previously generated passwords from the file, and store them …

Member Avatar for tux4life
0
880
Member Avatar for dumdumsareyum

Read the information on the web page below very carefully, and then you can get started by upgrading your code to more decent C++ code. [url]http://siddhant3s.googlepages.com/how_to_tell_rusted_cpp.html[/url]

Member Avatar for Salem
0
150
Member Avatar for VBNick

This post has nothing to do with the converting between those two, but with: [B][U]Bad coding practices![/U][/B] [LIST=1] [*][ICODE]!fin.eof()[/ICODE] Check out [URL="http://www.gidnetwork.com/b-58.html"]this[/URL]. [*][ICODE]system("pause");[/ICODE] Check out [URL="http://www.gidnetwork.com/b-61.html"]this[/URL]. You could use [ICODE]cin.get()[/ICODE] as a replacement. [*][ICODE]return 1;[/ICODE] Why would you want to return value 1 if your program has terminated correctly? Make …

Member Avatar for Salem
0
258
Member Avatar for nanchuangyeyu

[url]http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[/url] (The steps are the same for your version of Visual Studio) Edit:: This link is not to demotivate you, it doesn't require much reading (only one line of text) and is very straightforward :P

Member Avatar for tux4life
0
89
Member Avatar for Whilliam

[QUOTE=Whilliam;912864]problem solved!!![/QUOTE] Maybe in future, you could mention how you solved your problem, so others, who get to this page (for example by using Google (everyone's friend :P)), having the same problem can see how to fix their problem.

Member Avatar for tux4life
0
96
Member Avatar for 9868

[B]>The type of the array is int, so the size of the array is 10 * 4.[/B] To the OP: Yes, on most implementations, this is the case, but certainly not on all. In that example you assume that an integer is 4 bytes. You can get the exact size, …

Member Avatar for Tom Gunn
0
91
Member Avatar for umair125

[B]>what should i do first plz help me[/B] Begin creating one of the classes, no matter which one you start with. Do you know how a class skeleton looks like? If no, then I would like to suggest you to read your text book first. Otherwise, give it a shot …

Member Avatar for Ancient Dragon
-1
480
Member Avatar for DoEds

[U]Step 1:[/U] Get an integer from the user (store it in a variable) [U]Step 2:[/U] Check whether the integer is higher or lower than zero: [CODE] IF number < zero: Print out the multiples ([B]Step 3[/B]) [/CODE] [U]Step 3[/U] (Get all multiples of 3 for all numbers less or equal …

Member Avatar for tux4life
0
108
Member Avatar for linkingeek

Hi [B]linkingeek[/B], welcome to this forum. Could you please [URL="http://www.daniweb.com/forums/announcement8-3.html"]post using code tags[/URL]? This makes the code much more readable.

Member Avatar for linkingeek
0
109
Member Avatar for Ather14

What??! Already the 5th post and nobody has told the OP to use code tags? To the OP: [url]http://www.daniweb.com/forums/announcement8-3.html[/url] (read that information please, before making any other post, containing code snippets)

Member Avatar for NathanOliver
0
181
Member Avatar for mrnutty

[QUOTE=firstPerson;912133]How could one share a .exe that loads textures. I am using c++ and openGL. I want to share the .exe that I made using rapidshare.[/QUOTE] Well, isn't the homepage informative enough? It describes you what to do: 1. Click the browse button: browse for your .EXE file you want …

Member Avatar for tux4life
0
84
Member Avatar for ivanhuk

Well, my first remark is that you don't have to call a destructor explicitly, it will be automatically called when the object goes out-of-scope (this is for example when you shut down your program), so don't write: [ICODE]~Question();[/ICODE] anywhere in your code. Edit:: ^^ Actually this is just giving a …

Member Avatar for Lerner
0
145
Member Avatar for noamco

[B]>Any ideas?[/B] Remove [B]ios::in[/B] :) EDIT:: I usually open files like this if I want to open them in text mode: [CODE=cplusplus] string fn = "test.txt"; ofstream fout; fout.open( fn.c_str() ); [/CODE] (I also used a [B]string[/B] like you did)

Member Avatar for noamco
0
176
Member Avatar for monkey_king

To the OP: Don't write your code like this: [ICODE]while(os.eof())[/ICODE], instead write it like jencas did. Want to know why? Do a forum search on: feof or eof :) Edit:: I thought it was safely to assume that the 'oef' in 'os.oef()' is a typo he made. (Because [URL="http://www.acronymfinder.com/AFAIK.html"]AFAIK[/URL] there …

Member Avatar for tux4life
0
482
Member Avatar for Shaitan00

You'll find [URL="http://www.daniweb.com/code/snippet1068.html"]this[/URL] code snippet helpful :) (If you're not allowed to use vectors, you can always adapt it to use an array) Or use [URL="http://www.cplusplus.com/reference/clibrary/cstring/strtok/"]strtok[/URL].

Member Avatar for jencas
0
191
Member Avatar for whotookmyname

Use [B]getline[/B]: [CODE=cplusplus] string s; cout << "Enter some text: "; getline(cin, s); cout << "You typed: " << s << endl; [/CODE] :)

Member Avatar for whotookmyname
0
80
Member Avatar for qkslvr1621

Well, your code can be easily fixed, change: [CODE] for (int x = 1; x <= numExs; x++) { [COLOR="Red"]total += x; totalxs = total * 'X'; [B]// (1)[/B][/COLOR] } [/CODE] to: [CODE] for (int x = 1; x <= numExs; x++) { [COLOR="Green"]totalxs += 'X';[/COLOR] } [/CODE] [B](1)[/B]: Wrong …

Member Avatar for qkslvr1621
0
104
Member Avatar for Samuelandjw

iostream objects are usually slower than printf, but the little efficiency you gain by using printf is not worth avoiding the flexibility of the iostream classes. (remember: iostream is not only cout, cin.)

Member Avatar for MosaicFuneral
0
1K
Member Avatar for Pavan_

If you specify [B]%d[/B] in the format string of the [B]printf()[/B] function, you also have to specify a corresponding integer value to print. [U]General rule:[/U] For each format specifier you include in the format string, you also have to supply a corresponding value (of the same type as the format …

Member Avatar for Tom Gunn
0
149
Member Avatar for spidyshiva

[QUOTE=csurfer;908650][URL="http://www.faqs.org/faqs/jpeg-faq/part1/"]Image Compression[/URL],[URL="http://www.audiodesignline.com/showArticle.jhtml?articleID=192200240"]Audio Compression[/URL] .You couldn't even find this.....?[/QUOTE] In a strange way, people here can't use Google, but they can find the forums :P (That's a relief!)

Member Avatar for tux4life
0
96
Member Avatar for Pavan_

[QUOTE=cool_zephyr;910449]when we do free the memory space reserved by malloc..does it free only the memory space not being used at that time or the whole memory space allocated by malloc??? [/QUOTE] [url]http://www.cplusplus.com/reference/clibrary/cstdlib/free/[/url]

Member Avatar for tux4life
0
245
Member Avatar for TarekSliem

Yes, change [ICODE]#include <iostream.h>[/ICODE] to [ICODE]#include <iostream>[/ICODE] and put the instruction using namespace at the top of your code or use the [ICODE]std::[/ICODE] specifier for each object (in namespace std) you want to use :) ... By the way: avoid using [ICODE]void main[/ICODE] it's unnecessary look here: [URL="http://cppdb.blogspot.com/"]http://cppdb.blogspot.com/[/URL] ...

Member Avatar for ankitloud
0
252
Member Avatar for reyaanhelp

And an addition to csurfer's post: Get rid of that [B]void main()[/B], it's evil! Change [B]void main()[/B] to [B]int main()[/B]. >How to convert structure to class in C++? Theoretically in C++ a structure is a class. Edit:: BTW, is your code working? As I cannot compile this crap on my …

Member Avatar for csurfer
0
457
Member Avatar for gretty

[QUOTE=gretty;909269]thanks for the links :) Is'nt that tutorial site learning API coding in C & not C++? I am not familiar with C.[/QUOTE] I know, it says that it's for C, but it will work with C++ as well.

Member Avatar for Ancient Dragon
0
263
Member Avatar for gergep

[QUOTE=Salem;909890]> For example, i want to know how does wxWidgets create there windows, buttons, etc. It's open source, go read the code.[/QUOTE] Well, I guess if he reads the [URL="http://docs.wxwidgets.org/stable/"]documentation[/URL] or some of the tutorials listed [URL="http://www.wxwidgets.org/docs/tutorials.htm"]here[/URL], it will be already more than enough for him :P

Member Avatar for tux4life
0
79
Member Avatar for imhunk

[QUOTE=imhunk;909582]hello. i want to get a free web space where i can upload my own created designs. i went in with some of the sites but they provide their own templet. so, please help me by giving me some names of such sites. thanks !![/QUOTE] Ever tried finding a free …

Member Avatar for ThinkFree
0
70
Member Avatar for TrintiyNoe

Declare the stringstream inside the for-loop's body: [CODE] for(i = 0; i < scoreSheet.size(); i++) { [COLOR="Green"][B]stringstream q;[/B][/COLOR] q << scoreSheet[i]; q >> z; cout << z << endl; } [/CODE] :) Edit:: In some cases, you might want to add an additional check as well: [CODE] for(i = 0; …

Member Avatar for kvprajapati
0
290
Member Avatar for catchmrbharath

Does your program directly crash after executing it? If no, what input are you entering? Also please answer the following: What compiler are you using? What OS are you on? BTW, what are you going to do when the user enters a negative value at the start of your program? …

Member Avatar for csurfer
0
227
Member Avatar for tag5

[QUOTE=tag5;908087]sorry i don't now how to use it please reply,[/QUOTE] Look at the link in adatapost's post :)

Member Avatar for tux4life
0
126
Member Avatar for balu naik

[QUOTE=csurfer;907336]Well [URL="http://www.microsoft.com/express/vc/"]VC++[/URL],[URL="http://www.bloodshed.net/devcpp.html"]DevC++[/URL] and [URL="http://www.codeblocks.org/home"]CODE::BLOCKS[/URL] are great.And in case you don't like them you can always go back to good'ol Linux for g++.[/QUOTE] Well, actually Dev-C++ and Code::Blocks are both IDEs featuring the MinGW compiler, a port of the GNU Compiler Collection. (e.g: g++, gcc)

Member Avatar for Ancient Dragon
0
162
Member Avatar for member9

[QUOTE=member9;902988]i cant understand what does ++*++p means??? can u help me[/QUOTE] Consider the following code: [CODE=cplusplus] #include <iostream> int main() { int a[5] = {0, 5, 2, 3, 4}; int *p = a; ++*++p; std::cout << a[1] << std::endl; return 0; } /* Output: 6 */ [/CODE] Explanation: The first …

Member Avatar for Ancient Dragon
-1
111
Member Avatar for balu naik

We can say nothing for sure if we can't see your code, but I can maybe use my physic powers to make a guess. Couldn't it be that you try to access [B]__cpu_features_init[/B] in a place where your program can't see it, or you've made a typo, or you just …

Member Avatar for balu naik
0
138
Member Avatar for scholar

Look, I found another post of you, about exactly the same: [url]http://www.daniweb.com/forums/thread201413.html[/url]

Member Avatar for Ramy Mahrous
0
71
Member Avatar for sgw

What you can also try is just recompiling the source of the file which is behaving incorrectly. (I compiled this source successfully using MinGW). What compiler are you using ? Could you just attach the whole file (the source of the file which doesn't work correctly) to this thread? (and …

Member Avatar for tux4life
0
172
Member Avatar for DoEds

[QUOTE=Dave Sinkula;904308]Consider [URL="http://www.daniweb.com/search/search.php?q=currency+converter"]searching this site[/URL].[/QUOTE] Eureka! I've found one, Dave: [URL="http://www.daniweb.com/code/snippet258.html"]http://www.daniweb.com/code/snippet258.html[/URL] :)

Member Avatar for Tom Gunn
0
359
Member Avatar for kostasxx

When running this code, variable [B]w[/B] contains an unknown value, this will nearly always cause an array override (unless you've much much luck). You've to (explicitly) assign [B]w[/B] a value as well, before using it anywhere in your program. [CODE] for ( i=3; i<[B]sqrt(100)[/B]; i++ ) { if ( [COLOR="Red"][B]x[w][/B][/COLOR] …

Member Avatar for kostasxx
0
92
Member Avatar for makymakaru

[B]>WARNING: NO NEW LINE AT THE END OF FILE >What should I do?[/B] Move your cursor to the end of the latest line of your file and press ENTER. Then try recompiling your source, the warning should be away.

Member Avatar for tux4life
0
109
Member Avatar for tactfulsaint

Look: [url]http://www.daniweb.com/forums/post906316.html[/url] Edit:: This double-thread is deleted by an Admin.

Member Avatar for tactfulsaint
0
118
Member Avatar for peterbrowse

To generate an executable you should 'Build' it, compiling is not enough. If you've compiled it, you still have to 'link' it to an executable file. The 'Build' menu command will do these things both: it first compiles your source, and thereafter it links your compiled object file to an …

Member Avatar for daviddoria
0
106
Member Avatar for dilip.mathews

[QUOTE=salie_90;906187]i need help please...i ask, to make a program that accepts a positive integers and displays all odd number between 1 to the integer entered (inclusive) accept the integer in main() and use a recursive function to identify and display the odd numbers. tnx..salie[/QUOTE] Don't resurrect old threads to just …

Member Avatar for tux4life
0
245
Member Avatar for salie_90

I'll give you a small start: (assume [B]number[/B] is an integer variable) A number is odd when the modulus is not equal to 0. For example: [CODE=cplusplus] if( number % 2 ) { // The number is odd } else { // The number is even } [/CODE] BTW, What …

Member Avatar for tux4life
0
349
Member Avatar for johnray31

It's not recommended to just program it like that because you return a pointer to a local (automatic) variable, and when the function returns, the variable will be 'destroyed' (this means: it doesn't exist anymore, the memory assigned to it will be marked: "allowed to use"), but you still have …

Member Avatar for johnray31
0
139
Member Avatar for Furtano

A simple example demonstrating a string passed by reference: [CODE=cplusplus] void func(string &s) { s += " something."; } [/CODE] This is just a useless function which adds "[B] something.[/B]" at the end of the string passed to the function, but it demonstrates the use of references. A call to …

Member Avatar for Furtano
0
199
Member Avatar for Ardvarks

[URL="http://www.daniweb.com/code/snippet1068.html"]http://www.daniweb.com/code/snippet1068.html[/URL]

Member Avatar for Ardvarks
1
139

The End.