2,839 Posted Topics
Re: [QUOTE=VernonDozier;611255] It is the "Bitwise OR" operator. [/QUOTE] Actually, it's the Bitwise XOR or exclusive-OR operator. But you're right, the pow function should solve this compiler-error. Small example: [code=cpp] #include <iostream> #include <math.h> int main() { std::cout << pow(3.0,2) << "\n"; std::cin.get(); }[/code] output: 9 (3^2) | |
Re: Do you want to program this you self? If yes: What language? Or are you looking for an existing program to do this for you? Based on these answers your thread will be moved to the right forum. | |
Re: This: [code=cpp] for(int i=0; i<dataset; i++) { cout<<"Enter values"<<endl; cin>>Pa>>Pb>>K>>L; } [/code] will overwrite Pa,Pb,K & L every time the for-loop loops. So you need an array or a vector to store all the datasets. Also please read the [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]rules [/URL]and use [URL="http://www.daniweb.com/forums/thread93280.html"]code tags [/URL] | |
Re: Write all the important vars to a file. You could use [URL="http://www.cplusplus.com/reference/iostream/ofstream/"]ofstream [/URL]for that. [URL="http://www.java2s.com/Code/Cpp/File/Writetofileofstream.htm"]example[/URL] | |
Re: [QUOTE=Agni;610426]Are we playing 'Read My Mind' here :) ...[/QUOTE] In theory, if we supplied ∞ answers, the right one would be among them :) So I'll have a look in my crystal ball and say....: Namespaces! [code=cpp] #include <iostream> namespace ClassSpace { class a { public: a() { std::cout << … | |
Re: [QUOTE=hocuz pocuz;610543]In my book it said if you use function, it would make the program runs slower isn't it?[/QUOTE] That's not something you have to worry about. If you were using a 15 year old PC and your program was x-times bigger, then it would become an issue. | |
Re: What the hell are you talking about? Do you exctually think that people are going to help you if you WWRITTE Like K!DDY lolz? Here are the [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]forum rules[/URL]. Read the part about 'keep it clean' then repost your question in proper English. | |
Re: [QUOTE=John A;607841]I see that Narue became a moderator because she [URL="http://www.daniweb.com/forums/thread19571.html"]requested[/URL] the position. [/QUOTE] Us simple mortals can't get in to Area 51, so we'll just have to believe that Narue asked for the position ;) | |
Re: No. [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]We won't do your homework for you[/URL]. Show what you've done so far, and you'll get help. Coding the lay-out of the classes shouldn't be too hard. ps. Adding 20 questionmarks and exclamationmarks won't help either. | |
Re: [QUOTE=TheGhost;604834]I have problems with the map, in the below loop. [CODE] for(it = aMap.begin(); it != aMap.end(); it++){ [...] it--; } [/CODE] [/QUOTE] The code above looks a bit funny to me... 'it' will never reach map.end if your increase and decrease it in the same loop. | |
Re: 1. No. System expects a const char*. So you'll have to do it like this: [code=c] const char s[] = "sky.exe"; system(s);[/code] 2. To my knowledge, this can't be done with system();. You're using windows right? How about using [URL="http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx"]ShellExecute[/URL]()? [icode] ShellExecute( NULL, "open", "sky.exe" , NULL, "C:\\", SW_SHOW );[/icode] … | |
Re: Off-topic: [QUOTE=Ancient Dragon;609610]That doesn't work. Needs to be [noparse][code=cplusplus][/noparse][/QUOTE] It works for me: cpp: [code=cpp] std::cout << a << "something\n"; [/code] cplusplus: [code=cplusplus] std::cout << a << "something\n"; [/code] I always use the first because I'm to damn lazy to type 'cplusplus' everytime I post code :) | |
Re: Something wrong with your [URL="http://www.daniweb.com/forums/thread124641.html"]other [/URL]2 [URL="http://www.daniweb.com/forums/thread124501.html"]threads[/URL]? Show how you've programmed the server and client. That way we can tell you how to implement this code in your existing code. | |
Re: Try this: [code=cpp] string output = google.ip_uri(ip50, ""); cout << output << "\n"; [/code] instead of this: [icode]google.ip_uri(ip50);[/icode] You should also check if argv has any values, else your program will crash when ran without any param,s. | |
Re: All the above, plus: try is a keyword in c++ (try...catch) so you might want to rename the function to something else. | |
Re: How about toupper()? [code=c] #include <ctype.h> [...] int main() { char up, buffer = 'a'; up = toupper(buffer); return 0; } [/code] There is another way, although some people don't recommend using it, because it doesn't work on all charactersets [code=c] char buffer = 'a'; buffer += '0'; /* add … | |
Re: You could 'pipe' the output to a text file: [icode]yourprogram.exe > output.txt[/icode] Now all the output you had, will be in the txt-file | |
Re: [QUOTE=Aamit;608028]Here is u r answer.. [/QUOTE] L33t speak is against the rules, and so is giving away free code. [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]Read this[/URL]. Now for your code... [code] void TestPrime(int ); void TestPrime(int n) {[/code] Why is the first line there? You don't have to declare the function if you're going to … | |
Re: In that case he's trying to make a bot. I'm not going to assist in a program that causes more spam. | |
Re: You have an error here: [icode] while (mark != -10, mark++)[/icode] Change it to: [icode]while (mark != -10)[/icode] And the program will end when -10 is entered The next time you post code, please use [URL="http://www.daniweb.com/forums/thread93280.html"]code tags[/URL] | |
Re: Yes it is. But it sounds like a virus to me, so I'm not helping. 'Sorry' | |
Re: PCH stands for 'Pre Compiled Header', so you've created a project that requires a PCH but you didn't include it. Just add [icode]#include "stdafx.h"[/icode] as the very first line in your code. Or turn PCH off, but since you didn't tell which compiler (version) you're using, I can't help you … | |
Re: On what line are you getting this error? Please post you code between [noparse][code=cpp] //code here [/code][/noparse] tags. That way line numbers will be added, which is handy with this amount of code ;) | |
Re: Why would you want to make a function for that, when the size() function already exists? Here's a code example of size() using Salem's demo-code: [code=cpp] std::map <std::string, std::vector<std::string> > array; array["fruit"].push_back( "apple" ); array["fruit"].push_back( "pear" ); cout << "The map 'array' has " << array.size() << " vector(s)\n"; cout … | |
Re: Two things: This is a typo: [icode]FILE *ifp, ;[/icode] Remove the comma: [icode]FILE *ifp ;[/icode] And you might want to read this about [URL="http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044841143&id=1043284376"]void main[/URL] The rest of the code looks fine to me. What doesn't work? | |
Re: Your struct looks fine. It's the opening and read of the file I'm worried about. "blahblehbloh" is not a variable. And why do you need 3 ifstreams? And I'm not a big fan of infile.eof() either Here's an example to get you on your way: [code=cpp] string line; ifstream file("blahblehbloh.txt"); … | |
Re: I think your wrong :) First of all: Thank you for using code tags! You didn't give an implementation of the destructor, but you told the linker that it should be there somewhere: [icode]~dolgoszt();[/icode] The easiest way is to change this: [ICODE]~dolgoszt();[/ICODE] in this:[ICODE]~dolgoszt(){};[/ICODE], but you would have a memory … | |
Re: [QUOTE=mertucci;607007]might it be like this? it has error so much but i cant analyze it [/QUOTE] No it's not. It has a lot of errors in it. (typos, missing constructors, accessing undefined variables). I always say: "if you know it won't work, don't post it. And always use [URL="http://www.daniweb.com/forums/thread93280.html"]code-tags[/URL] when … | |
Re: [QUOTE]or push d functions wud differ as push(stack) in parent stack and push(int) in mini stack....[/QUOTE] Yeah....whatever. Please read the [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]rules [/URL](part: keep it clean) How about you use a vector for your 'mini-stack' and then make a map of vectors for your big (stack-)stack Since if written this samplecode … | |
Re: First of all, I would suggest you read your file like this: [code=cpp] string line; ifstream infile("abcdef.txt"); while (getline(infile, line)) { // do stuff } [/code] That way you can use the benefits of the std::string and you don't have to worry about the siz of char arrays etc. So … | |
Re: Post the code where you read the file, that makes life a lot easier. But you'll have to do something like: [code] while (lines in file) { while (words in line) { storage[line][word] = inputread; word++; } line++; } [/code] | |
Re: You function doesn't really make sense. - Are you comparing 2d or 3d arrays? - What is "data" and where did it come from. - Are the two matrices the same size? If I wanted to make something that 2 matrices of equal size, I would do something like: [code=cpp] … | |
Re: In line 91 you say: [icode]return name;[/icode]. Name is declared as [icode]char name[30][/icode], so it's an array of 30 chars. But you've defined your function like this: [icode]char Person::personFind(char pid[])[/icode] so it can only return 1 char. To solve the problem, I strongly suggest that you use std::string instead of … | |
Re: [quote][code] bool matrix::load(istream& ins) { [....more code....] return array; return true; } [/code][/quote] You can't return array because the function can only return a bool. So it will return 'true' because the memory-address of array != 0 Why don't you just use the private float** data; to store the data … | |
Re: A lot of things are wrong with this code. But before I begin, you might want to read [URL="http://www.daniweb.com/forums/thread93280.html"]this [/URL]about code tags. I'll start at the top: [code] struct itemPrice // this is a global declaration { char id; double price; };[/code] Id is a char, but later in your … | |
Re: [URL="http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_sorting.aspx"]Here's [/URL]a great tutorial with some example code. (scroll down to heap) | |
Re: Which would be [URL="http://www.daniweb.com/forums/forum4.html"]here[/URL] And welcome ;) | |
Re: A few things come to my attention: [code] int n,p2,p3,p5,p7; a[1]=n=p2=p3=p5=p7=1; [/code] That's awful, what are you doing here? [code] while (a[n]<2000000000) { [/code] You never increase n, so it will always write in the same element, Besides: You declared 'a' as an array of 6000 ints, so there's no … ![]() | |
Re: A char will always only hold 1 character so: [icode]char ScheduledIn[1];[/icode] is useless. It is indeed the cause of your problems. ScheduledIn is now a pointer to the first element of an array of chars. So change it back the way it was. [code] if (ScheduledIn != 'Y' || ScheduledIn … | |
Re: you created a project that requires a precompiled header. So: [icode] #include "stdafx.h" [/icode] and the problem is solved. Why are you using 2003 btw? You can download 2008 for [URL="http://www.microsoft.com/express/"]free[/URL] [edit] Brilliant minds think alike ;) Only mine works slower then Ancient Dragon's. Just kidding ofcourse | |
Re: I like [URL="http://www.cplusplus.com/doc/tutorial/functions.html"]this [/URL]tutorial about function better | |
Re: [QUOTE=sonia sardana;605893]hey frnds,[B][COLOR="Red"]First of all Thx,CZ its ur contribution [/COLOR][/B]also with the help of which I cleared VB.Net interiew & my joining is on Coming Monday. Actually I have to develop there the Mobile Applications & games. So if somebody have the similar project ,pls paste the code here.[/QUOTE] It … | |
Re: [QUOTE=freshface001;605894] can posible to connect ms-access or sql database with c++ ?[/QUOTE] yes [QUOTE=freshface001;605894]if posible tell the tips to do it......[/QUOTE] This question has already been asked a 'few' times before. Just [URL="http://www.daniweb.com/search/search.php?q=mysql+c%2B%2B"]search [/URL]this site | |
Re: It's explained very well [URL="http://en.wikipedia.org/wiki/Bubblesort"]here[/URL] If you know some c++, it won't be too hard to write. Come back if you have problems (and code) ![]() | |
Re: [quote]2004 is not a leap year if I'm not misstaken [/quote] You are mistaken. It was a leap year. | |
Re: [icode]if (0 <= x && x < 49)[/icode] can also be written as [icode]if (x >= 0 && x < 49)[/icode] Now what would [i]you[/i] think will happen if x == 0 ? | |
Re: I don't really understand what you are asking. But if you want to check if getline failed or not you could use something like this: [code=cpp] if (getline(your_stream, your_string, ' ') == failbit) cout << "something went wrong\n"; else cout << "Extracted 1 word\n"; [/code] |
The End.