481 Posted Topics
Re: Can i also point out that those are C functions. If your after the C++ solution it goes something like this [code=cplusplus]#include <ofstream> #include <iostream> using namespace std; int main(void){ ofstream out_file; out_file.open("example.txt"); if(out_file.is_good()){ out_file << "\nHello, World"; out_file.close(); }else{ cout << "Error Opening File"; cin.get(); } return 0; }[/code] … | |
Re: Just a though but you may need to be a little be more specific when you say graphics... also i would suggest pasting some sample code, that demonstrates the problem Chris | |
Re: [QUOTE=Ancient Dragon;729845]Is that even possible? How can a computer program know if sound is actually coming out of the speakers or not? But maybe there's some interface with the sound card API that will indicate that ???[/QUOTE] My guess would be it would get even more specific...I.E different for each … | |
Re: I think you forgot to state what the problem was, all you did was post the problematic code and a whole lot more code... Chris | |
Re: You could always use something like this....ofcourse you need to adapt it [code=cplusplus]#include <iostream> #include <string> #include <sstream> using namespace std; int main(void){ ostringstream hello; hello << hex << (int)'A'; cout << hello.str(); cin.get(); return 0; }[/code] Chris | |
Re: Whats wrong with cstdlib & cstdio, this is C++ not C. The previous post uses string stream which are brilliant for this. You may also want to consider looking at strtol(). Chris | |
| |
Re: Google -- [url]http://msdn.microsoft.com/en-us/library/aa364418(VS.85).aspx[/url] Always read up on functions before you try and use them. well i think you forgot to declare the variables pathSz, pathBf & bufSz or at least in that scope. Chris | |
Re: Hmm.... code tags, there a nice thing [noparse][code=c][/code][/noparse] Also this looks like C to me not C++ Could just be me but i'm quite sure its not C++ Chris | |
Re: Just to note, this sort of thing is better done with a macro [CODE=cplusplus]#define SIZE 101[/CODE] Chris | |
Re: think you may need to use the & operator before the variable you are passing. Chris | |
Re: Read the file line by line, split it into tokens based on spaces, then convert the number token into a double from a string. You may want to look at. getline() strtok() strtod() Hope that helps, Chris | |
Re: Firstly look at socket programming, to start understanding how to work over a network Chris | |
Re: Is it just me that thinks this or are cmath & math.h the same thing? Chris | |
Re: i would suggest looking at the ascii code for the character. To start with the ascii code for 'A' is 65 and for 'Z' is 90, there rest lie inbetween unsuprisingly. You first step would be to determine ig it is on the right or left hand side. So is … | |
Re: I think i have missed the actualy problem here. Could you explain why you are having trouble with integer division. I see no reason for it not to work if you use doubles. Chris | |
Re: Very little information here, also i've never programmed microcontrollers in C++ only a version of assembly. However the name bsend indicates [B]b[/B]it[B]send[/B] And so that would mean its sending bit via the output pin. Chris | |
Re: [QUOTE=cerb63;719743]she wants it to do whats in the description[/QUOTE] You haven't actually presented us with a problem. You have said it should do this, and not actually pointed out where you are stuck...we don't do it for you we aid you. We are not going to write entire sections of … | |
Re: 1) Code Tags 2) Provide all the code that is the problem - this is may include header files etc Chris | |
Re: Firstly you will need to use API's calls. Secondly you will probably need to know something about what information the Joystick actually sends to the computer and how it is interpreted by the driver application for it. Once you know that then you can start work on writing a wrapper. … | |
Re: 1) How doesn't it work? - What errors do you get? 2) Does it compile but not give the expected result? 3) Which section of code is or do you think is the problem? 4) use [CODE][[TEX][/TEX]/CODE] tags If your using C++ code why are you including things such as … | |
Re: No there isn't and again no. You would have to write your own. Search the forums its a VERY popular question. It will turn up alot of material for you to look at, including recursive and non-recursive. Chris | |
Re: [QUOTE=Salem;718929]> EDIT: im using windows xp pro, if that helps. But which compiler? Not some fossil like TurboC by any chance? > send a high or low signal to the corresponding output pin on a serial port Er, you do know what a serial port looks like right? Or even … | |
Re: [QUOTE]It works. I just figured it out this past Sunday.. I am new to the programming world so my "style may not be too good.. [/QUOTE] Your using C syntax in a C++ forum.... Also use [code][/code[tex][/tex]] please @OP rounding it off can be done by adding 0.0005 etc which … | |
Re: Just to summerise incase you don't bother reading, which wouldn't supprise me. 1) We do NOT do homework 2) We WILL help if YOU provide proof of attempts 3) Show where you are stuck 4) Provide detailed information about your problem Chris | |
Re: /*BINARY SEARCH PROGRAM BY SUMAIR IRSHAD*/ #include<stdio.h> #include<conio.h> void main(void) { clrscr(); int arr[]={1,3,5,7,9,11,13,15,17,19}; int i,target,start=0,end=10,mid; printf("enter target"); scanf("%d",&target); while(target!=arr[mid]) { mid=(start+end)/2; if(target==arr[mid]) { break; } else if(target<arr[mid]) { end=mid-1; } else if(target>arr[mid]) { start=mid+1; } } printf("target found at %dth location",mid+1); getch(); } Where to start. 1) Use code-tags … | |
Re: For reasing the data i would use a while loops thats condition is the file reading operations its self such as [CODE=cplusplus]while(getline(afile, myString)){ //code here }[/CODE] Chris | |
Re: [ICODE]menu (char symbol);[/ICODE] Should be [ICODE]menu (symbol);[/ICODE] Chris | |
![]() | Re: [QUOTE=sidatra79;718656]First of all do u know what a bucket sort is? :D[/QUOTE] I'll agree with this, you should do some research as to what a bucket search is. Also how will you be implementing it? Will it be a recoursive bucket sort and thats it. Or will it be a … |
Re: Still learning you still seem to have the problem of the fact the first character is not printed. This is because in your loop to print it out backwards you are checking to see if it is > than 0 baring in mind that arrays are 0 index'ed that means … | |
Re: Why are you defining your own PI when cmath comes with M_PI which is alot more accurate than yours? Chris | |
Re: using console redirection is not how to read from a text file, [url]http://www.cplusplus.com/doc/tutorial/files.html[/url] is an example of how to read from a text file although it incourages bad things such as while ( !eof ) and .is_open(). But thats for another day Chris | |
Re: just a note on the loop [CODE=cplusplus]while (STAMINA || ENM_STAMINA != 0 )[/CODE] I'm not to sure what you think this means exactly (althought its ok this time), but im guessing its not what it actually means. it would be evaluated as follows [CODE=cplusplus]while ((STAMINA) || (ENM_STAMINA != 0) )[/CODE] … | |
Re: hmm not to sure why that would be it seems ok to me.... one thing i wanna point out is as follow's its just a little neater [CODE=cplusplus]case 'R': rev_str(); break; case 'r': rev_str(); break;[/CODE] is the same as [CODE=cplusplus]case 'R': case 'r': rev_str(); break;[/CODE] Chris | |
Re: Yer there is another option that would require someone to right a not to complex script for you. That could check for all duplicate files & folders and move them to a specified location. It shouldn't be to complex either. Plus you can garuntee what will happen that way, Chris | |
Re: Would it not just mean adding some form of a break in the text file? For example enter an 'x' after the first matrix, then the program knowns it finished and can call again for the next. Maybe i missed something? | |
Re: Shouldn't thisbe the other way around? [ICODE]parse=newzipcode;[/ICODE] so this... [ICODE]newzipcode=parse;[/ICODE] Maybe i missed something Chris | |
Re: windows.h has a Sleep() function, this will allow you to stall the application for a short period of time each loop, thus reducing the processor usage to 0 or almost. Chris | |
Re: [code=cplusplus]std::cin >> ipadd; commandArg = "ping " + ipadd.c_str(); system(commandArg);[/code] Something along those lines should do you nicely. c_str() is in the string header btw. Chris | |
Re: [QUOTE=dmanw100;714085]You need to seed the random number generator to make it generate a true random number. Try [CODE]#include <ctime> .... srand((unsigned)time(0));[/CODE] As for not having enought money you may want to try putting "break" statements at the end of your switch cases... but I forget[/QUOTE] He already does seed it, … | |
Re: I would question Zone Alarm, it is very good i have to agree. However it can get very tempramental and be a major cause of blue screens, Comodo is a very good firewall as long as you have the paitents to fully configure it. Every incoming connection of any kinda … | |
Re: [QUOTE=chococrack;714219]The answer is most assuredly forty-two.[/QUOTE] Well what else would it be, although i don't feel that this is important enought to be given an answer equivelant to the meaning of life! but seriously, whats the question / problem? Chris | |
Re: if you ask me, Dev-Cpp. Used from the start til not long after the start (aka now lol). Nah Dev has stood me in good sted and never let me down Chris | |
Hi, i'm havnig problem with calling CreateThread. The problem is that it gives me a conversion error from const void* to void* [CODE=Ccplusplus]DWORD dwThreadId; HANDLE myThread; myThread = CreateThread( NULL, 0, MyThreadFunction, "HELLO", 0, &dwThreadId); [/CODE] dwThreadId id is the problem, the function is supose to take a pointer to … | |
Re: That looks right to me, next state it to convert that into code, be it C++ or psuedo. do each point indervidually, don't try and mix them up. Chris | |
Re: To build on what Sci@phy siad, narrow it down to a small section of code aswell. Don't expect us to read all of that when we may only need to look at 5 lines of it! Chris | |
Re: Not to sure what your actualy problem is but you are assigning X to [0][0] where X is a char that doesn't have a value and is not initialised. So you assign some random value from your memory into the array. NOT GOOD. Chris | |
Re: Your going into searching and sorting algoithms. If the numbers are in ascending order then you can perform a bnary search which optimizes speed for finding the number. If is is not sorted into order then you must perform a sor of some kinf such as a quick sort. check … | |
Re: [QUOTE=praveensleeps;713389]U should start with Socket programing; reffer to book "beejs guide to network programing " u can do it with in 3 days[/QUOTE] I would question what, i think he may have problems installing a compiler on his pc let alone managing to write a simple hello world application, since … |
The End.