- Strength to Increase Rep
- +12
- Strength to Decrease Rep
- -3
- Upvotes Received
- 115
- Posts with Upvotes
- 98
- Upvoting Members
- 37
- Downvotes Received
- 19
- Posts with Downvotes
- 17
- Downvoting Members
- 12
518 Posted Topics
Re: >i need code for scientific calculator in vc++ by using switch case statement So tell me what have you tried. Remember, we don't provide codes. We only help those who show efforts. Please try and then tell us on what part are you having problem. | |
Re: [URL="http://curl.haxx.se/"]cUR[/URL]L is the library which is used to do HTTP/FTP and similar protocols. There is a decent binding [URL="http://curl.netmirror.org/libcurl/cplusplus/"]cURLpp[/URL] for C++ which would be best for what you want. PS: C++ language as such do not have such functionality. | |
Re: One suggestion would be to build a html parsing program and then perhaps connect to [url]http://primes.utm.edu/lists/small/10000.txt[/url] and read out the list of primes into the memory and write them down to a file. Or you could choose[URL="http://www.numberempire.com/primenumbers.php"] this[/URL] website but the you'll need HTTP/POST feature to get the prime. PS: … | |
Re: Well, the therad is burnt now. The solution has been pointed by s.o.s ( sorry I am not putting those tildes). Tylor Theorm will come handy to you for all this 'magical' function. you could even calculate sin,cos,tan, etc etc. But this is not the correct way to learn programming. … | |
Re: I agree with Hemsworth. C++ is a programming language. You project do not require any programming backbone. You should also use a similar animation suite. If Adobe Flash is not affordable, you might look at Open Flash [url]http://www.osflash.org/[/url] Also, have a look at [url]http://www.openlaszlo.org/[/url] It is not good to use … | |
Re: If everyone is giving opinions, I would also cast my vote to GNU GCC If you are on a Linux, you probably already know about it. GNU g++ is the command line compiler. But there exists various IDE like Dev-C++ which uses GNU g++ as the compiler. I personally use … | |
Re: >>If I could write it, I wouldn't be asking for help. This doesn't work this way. Ancient Dragon wanted you to tell that you need to give more detail and the account of the effort you put in. Also, everyone is supposed to read the Sticky thread:[url]http://www.daniweb.com/forums/thread78223.html[/url] and also the … | |
Re: >>Then you can use stricmp() stricmp is not a standard function. | |
Re: Yes. Input the date as a std::string . Then use the[URL="http://www.cplusplus.com/reference/string/string/substr/"] substr[/URL] function to slice the string to get individual strings for Date, Month and year. Lastly you would want to convert the std::string to integer, Use stringstream to convert the string into the integer(refer [url]http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.2[/url]) | |
Re: >I wonder why some schools still insist on using Turbo when everyone in real life >know that it's a crappy-nonstandard-outdated compiler. >Can someone please explain? It is called the we-first-teach-students-basic-and-then-move-to-advanced-compiler philosophy but they often forgets that it is very hard for students to quite that crap. Or may be they … | |
Re: Do one thing: Go to the compiler and just try to comment out the line [icode]ifstream inFile; [/icode] Check if it runs or not. If it does, tell us. If it doesn't Try to comment-out [icode]#include <fstream>[/icode]. If it now runs, tell us. If it doesn't, there is some problem … | |
Re: >For integers, it will be just as accurate as the iterative or recursive version. Okay heres the bottom line: If you want to calculate the nth Fibonacci number, use the closed form(i.e. the formula mentioned in Post #3). If you want to print the series till some n, always use … | |
Re: >>Btw. in your for loop you don't have to test all the way to x. It is sufficient to test just to the square of x. He meant the square-root and not the square of x. ( must be a typo) To the OP, The suggestion of ddanbe is the … | |
Re: You may use third party library like libcURL([url]http://curl.haxx.se/libcurl/[/url]) which works well in fetching such webpage as strings. If you problem is solved, please mark the thread as solved so that others don't waste time on this problem. | |
Re: int is a very poor choice for a data representation of Date. The right thing would certainly be to accept the user input as string -- [I]as is[/I] and then parse it according to your needs. I would even go as to creating a struct for holding three short int … ![]() | |
Re: To the OP: When we (at least I) ask you to show up a code and we will try to fix it we say it in a spirit that a car mechanic would say ``Sir, I can't build a car for you, but if you have a defective car, I … | |
Re: The easiest way, which is in fact the more elegant way to do things would be to declare a struct or class of a [I]card[/I]. Create a vector of such 52 cards and use the standard library's [I]random_shuffle[/I]() [[url]http://www.cppreference.com/wiki/stl/algorithm/random_shuffle][/url] to shuffle it. ![]() | |
Re: >it's working but the code is very complex to me Do not know about the complex part, but the code is wrong, do not follow it. caut_baia, you were wrong in two ways: first, you tried to give the OP a direct answer which can spoil his fun of `getting' … | |
Re: I can't see where are you comparing a pointer and an int. In the loop condition, msg[size] is a char and i is an integer. Pretty legal. msg[size] is having value 0. So I guess the loop would never execute. PS: If your compiler is generating any error, please post … | |
Re: >>.i will user ur code as a reference code and will write my own code after >>undertanding it You know, first I thought I should believe your on this. But then my 6th sense told me not to. I am sorry. | |
Re: Take a paper, take a pen. Scribble something until it makes sense. Posting without trying is not wise, It just show your ignorance. Although we are here to solve your queries, We, can't work until we have some berries. Those berries are your tries, So, don't post before attempting, it … | |
Re: Arrays and pointer are closely related in C. But first tell me what book are you using? Anyways, one advice: your scripting languages like Python and Perl makes you feel that programming is fun, this is not the case with C. I am sure you will have to do quite … | |
Re: >>Yeah, it's .c_str() NO. it is [URL="http://www.cplusplus.com/reference/iostream/stringstream/str.html"].str()[/URL] for string streams.It will return a string object on which you will have to do a .c_str(). So the corrected code would be somewhat like this: [CODE=cplusplus]#include<iostream> #include<sstream> int main() { std::stringstream arg; const float pi=3.145745; arg<<"AdjustSealevel.exe "<<pi; std::cout<<arg.str().c_str(); system( arg.str().c_str() ); } … | |
Re: Perhaps this [url]http://www.boost.org/doc/libs/1_41_0/libs/numeric/ublas/doc/matrix.htm[/url] or this [url]http://www.osl.iu.edu/research/mtl/[/url] | |
Re: >I need a function in c++ to calculat the age of a user, by asking the user to >enter his birthday. I think you're confusing this forum with the one who give away code. Read the forum announcement. We help only those who show efforts. What have you tried so … | |
Re: I suggest you to change the return type of the `menu()` to int. If the user wants to continue return 1 and he doesn't wants to continue(that is, when he pressed 5), return 0 Then inside your `main()`, you can simply do like this: int main(){ while( menu() ); } … | |
Re: >for ex if an array has 10 items then n-1 would give u the size of that >array, since index of arrays stars from 0. I think it should be that if an array has [U]n[/U] items then n-1 would give u the [I][U]highest possible subscript[/U][/I] of that array, since … | |
Re: The if-else is redundant; A number which is smaller than 10, when undergoes modulus operator with divisor as 10 will yeild that number itself. 7%10=7 1%10=1 and so on... Your reverse function is not designed well: You are trying to print the reversed value of the number in the function … | |
Re: Aladdin's Magic lamp. 2 Burgers, 1 Large pizza with extra cheese and a diet coke. Sh*t, nothing is working. This website is junk | |
Re: Well, I remember I ran into a problem when I needed to install MinGW on a machine with no Internet Connection. So here is what I did: I downloaded the Codeblocks setup from the website: the one which is of nearly 20MB ( that comes along with MinGW). I installed … | |
Re: [url]http://www.ittb.pcriot.com/forum/viewtopic.php?t=24[/url] Here is your answer. | |
Re: >how to use isalpha to chech for a character Check the [URL="http://www.cplusplus.com/reference/clibrary/cctype/isalpha/"]reference[/URL]. Next time, if you intent to ask a C-related question, check out the C Forums of this website. By the way, a quick example of isalpha is: [CODE=c]#include<stdio.h> int main() { char c; printf("Enter a char"); scanf("%c",&c); if(isalpha(c)) … | |
Re: Learning from examples is a great way to understand things; only if you understand the example completely before trying to fit your crude analogies. And when you are not able to construct a basic loop, a quick look-up on to your text book wont do harm. I would suggest you … | |
Re: If at all you want to throw string literals, remember that they are const char* not simply char*. So refactor your code as: [CODE=CPP]void Xhandler(int test) { try { if (test) throw test; else throw "Value is zero"; } catch (int i) { cout << "Caught One! Ex. #: " … | |
Re: Uh good. But I think you realised your limitation. For sorting integers, there are [URL="http://en.wikipedia.org/wiki/Sorting_algorithm#Summaries_of_popular_sorting_algorithms"]many algorithm available[/URL]. But before that, you need to build a common program to try those. This program includes code to input N numbers into an array. Then it sorts the array using one of the … | |
Re: >U dont need to validate them like that. Actually he needs to. If the user enters any non-numeric character, his program can hang, halt, break or whatever. The worst part is, that the programmer won't be able to display a error message. >Link failbit, badbit, goodbit and stuff only makes … | |
Re: [QUOTE=Towel][CODE=cpp]rev1 = 0; { num3 *= 10; num3 += rev1%10; rev1 /= 10; }[/CODE][/QUOTE] Looks like you are trying to loop some statements. But the syntax of the loop is not correct. Read [url]http://www.cplusplus.com/doc/tutorial/control/[/url] (Loops) to find out the correct format. | |
Re: [URL="http://www.cplusplus.com/reference/iostream/stringstream/"]stringstreams[/URL] are often useful when you want to parse a sting input, specially when you need to do something with words. So make a stringstream and use the >> operator to fetch out one word at a time. Check if that has a .length() equal to 3. If yes, increase … | |
Re: Use a s[URL="http://www.cplusplus.com/reference/stl/map/"]td::map[/URL]. Create a map<std::string, int>. Scan through the file and insert each of the word to the map with initial value 1. If the word already existed, increment its value. Study the insertion example given on [url]http://www.cplusplus.com/reference/stl/map/insert/[/url] | |
Re: Consider the parenthesised version of the OP's code: [CODE=cpp] double ExprTree::evaluate(TNode* p) const { //this is the first if if( p->data == "+" || p->data == "-" || p->data == "*" || p->data == "/" ) { double op1 = evaluate(p->left); double op2 = evaluate(p->right); if(p->data == "+") //if number … | |
Re: >>nope.can you help me solve my problem??please... >>hey there FirstPerson.I m new with c++ so i think i m zero with it.can you help me >>with my problem?? >>As you know firstPerson i m new with c++.I m think i m a litle bit blur what just you >>tech me..Sorry.Could … | |
Re: Get some sand and clay. Try to first model desks and benches. Then model teacher and students. And your class is ready. | |
Re: >>little ugly Is it? This is the correct way to the thing what you want. You create a class template when you want to separate the implementation of the whole class according to the template parameter. But here, this is not what you want to do. In fact, you could … | |
Re: >can u plz explain that when is the order of precedense will be right to left? Are you deaf? Look at the post #2 and try to accept that what ever niek has said is actually true. Your program is suffering from [URL="http://en.wikipedia.org/wiki/Undefined_behavior"]undefined behaviour[/URL]. All that means to you is … | |
Re: >In your function, you allocate new memory for the array >that is passed, which already has been allocated memory. I suppose he has commented that line. Hence technically, there are no memory leaks in the first program. OP>Why is that anyone know? That is because the .size() member function of … | |
Re: >1. Passing into a function and then into a sub-function. Did you asked Google? Anyways, I did it for you: [url]http://www-ee.eng.hawaii.edu/~dyun/ee160/Book/chap6/section2.1.2.html[/url] >2. Passing 2d arrays, this had just mucked me up. [url]http://www.physicsforums.com/showthread.php?t=270319[/url] and [url]http://cboard.cprogramming.com/c-programming/97898-passing-2-dimensional-array-function.html[/url] >3. Making comparisons between pointers and ints Sorry I did not got this properly to make … | |
Re: I think one should always try to look at the date of the last post before replying to a thread no one is interested to read. It is more than an year old. | |
Re: >Got exam tomorrow So you've been screwed. Now did you remember when your instructor told you to read a text book? >Anyone know that c program got wat type of error? [URL="http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-no-answers.html"]Yes[/URL]. | |
Re: >Task: >Write a program to grade a test and print the student’s score. The task was given to you. You will be given grades for that. You are redirecting the task to us, we won't get anything out of it. But that was perfectly fine if you could get any … | |
Re: >Seriously? There's no options that do this for regular functions, the >same way it can be done for the main function when it's handed >command-line arguments? I thought it was possible to do C++ supports function overloading in which you can have variable number or arguments: [code] int fold(int x,int … |
The End.