447 Posted Topics
Re: Should try the typical FAQs. [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044844545&id=1043284392[/url] You don't need conio for gotoxy, if it's the gotoxy I was thinking of. | |
Re: This is an interesting discussion alright. Some of the views here I agree with, some I have to think about, but the funny thing is that it doesn't really matter. If God made the universe he might have done it via evolution or by the ways discussed in the Bible, … | |
Re: [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1048382857&id=1043284392[/url] Should cover most systems. | |
Re: No. You'll have to write a cyclic shift macros or function. ie, something like #define cyclicShiftRight(val,shiftBy) ...code here... #define cyclicShiftLeft(val,shiftBy) ...code here... //... char num = 0x80; //1000-0000 cyclicShiftRight/Left(num,3); //0000-0100 | |
Re: Nah. You'll probably have to specialise the template, I'd say. Or overload a > operator, if you feel like it. | |
Re: Do it more like this:[code]char fileName[30]; printf( "Enter filename: " ); scanf( "%s", fileName ); FILE *pFile; pFile = fopen( fileName, "r" ); ... etc fclose( fFile );[/code]Though technically this is C++ so you should use fstreams, really. | |
Re: At a guess I'd say that [inlinecode]fileHandle = fopen(Name,"w");[/inlinecode] should be changed to [inlinecode]"a"[/inlinecode] or something. If the function's being called more than once you'll want to append data to the file rather than write to a clean file, right? | |
| |
Re: You can do what's called 'template specialisation' which will implement certain functions for a specific type, basically.[code] template<typename ty> class myClass { private: ty var; public: myClass( ty i ); void print( void ); }; template<typename ty> myClass<ty>::myClass( ty i ) : var(i) { } template<> void myClass<char>::print() { std::cout<< … | |
Re: I'd've thought if you were comparing binary data the [inlinecode]memcmp[/inlinecode] function would have taken [inlinecode]const void*[/inlinecode]'s rather than any kind of [inlinecode]char*[/inlinecode] abstraction. | |
Re: In some physics expeiments they make very long and narrow bar magnets to simulate monopoles. Odd-opoles are awkward. | |
Re: I think the risk is worth it on the off chance that it's legit. On the other hand I once got some spam which filtered through. It was the typical kind of thing that you might expect, but what really tickled me was the fact that they had a few … | |
Re: Please elaborate. A linked list I can understand. Exclusive or I can understanc. Doing a linked list using XOR ... I'm not certain what you mean. | |
Re: In Ireland it's about €1.10 a [B]litre[/B], a gallon is 3.785411784 litres, which translates to about $5.20 for a gallon of Irish petrol. How do ye decipher between petrol and diesel? Are they both called gas? | |
Re: Why are you flushing so much? The problem is that you can't directly print an array. You have to print from both indices, so [code]for(k=0;k<3;k++) { for(l=0;l<3;l++) { mat[k][l]=(mat1[k][l]+mat2[k][l]); cout<<" "<<(mat[k][l]); } cout<<"\n"; }[/code]Also, iostream.h isn't standard. <iostream> is. Which compiler are you using? | |
Re: Leave the computer idle until it's automatically put on. Didn't look closely at this but it looks like it might be useful. [url]http://www.dreamincode.net/forums/showtopic17214.htm[/url] | |
Re: You could do it (quite unstandardly) via[code] #include <iostream> #include <string> // Non-standard library #include <conio.h> int main() { std::string password; std::cout<< "Enter password: "; for( char ch=getch(); ch != 0x0D; ch=getch() ) { password += ch; std::cout<< "*"; } std::cout<< "\nThe password is: " << password << "\n"; return … | |
Re: It depends on my mood. I like it with nothing, sugar, milk, or cream and most combinations of the above, haven't tried it with milk and cream, but all others stand depending on my mood. I had it with a little milk today. But, like JBennet, I prefer tea. In … | |
Re: Saving settings simply involves saving details to a file. Normally there are a number of variables you require, say name, age, etc. So I save them in a file like so:[quote]USERNAME:twomers USERAGE:22[/quote]Then I read in the file into a std::map<std::string,std::string>. The first parameter is the bit of the line before … | |
Re: I think williamhemsworth's right, but I think you can export all members of a class in one swoop: dll.h[code=c++]#include <iostream> #ifdef TWOMERS_BUILD_DLL #define TWOMERS_EXPORT __declspec(dllexport) #else #define TWOMERS_EXPORT __declspec(dllimport) #endif class TWOMERS_EXPORT myClass { private: int thing; public: int returnThing(); void setThing(int _thing); };[/code] dll.cpp:[code=cpp]#include "dll.h" #define TWOMERS_BUILD_DLL int myClass::returnThing() … | |
Re: This year my family is doing a secret santa, so instead of having to conceive of seven presents to buy one! I bet I'll still (A) buy a bad present, (B) leave it late and (C) buy it for the wrong person though. | |
Re: >> 1984 I was disappointed by that. >> Da Vinci code Eh ... I think Dan Brown's a very bad author. I love classics (somtimes), and I have a great 150 year old collection of Dickens' works. It s great for reading during storms with a large cup of tea. … | |
Re: Pink (brings out my eyes). Black tea/coffee or tea/coffee with milk? | |
Re: I play a good chunk of the aforementioned instruments. I love atmospheric, solo, non-pretentious piano jazz though. I could listen to that [I]aaaawwll[/I] day. | |
Re: Two things first. Use `<iostream>` and not `<iostream.h>`. Also use `int main()` and not `void main()`. What problem did you encounter? It might be best to encapsulate the variables in a structure, and then make an array of 80 of these structures so that the name, gender and CGPA of … | |
Re: You can do this quite elegantly with the STL... might be advanced, I dunno.[code=cpp]#include <fstream> #include <vector> #include <string> #include <algorithm> bool char_sort_function( char a, char b ) { return a>b; } int main( int argc, char *argv[] ) { // File contains: This is a test! std::ifstream in( "test.txt", … | |
Re: [URL="http://curl.haxx.se"]libcurl[/URL]. It's fairly straightforward after you get used to it. Edit: Once you get the library working [URL="http://curl.haxx.se/lxr/source/docs/examples/sepheaders.c"]this[/URL] should pretty much do the trick. Just open the file in binary mode and I think it should work. | |
Re: Well, there are two common ways you can represent complex numbers. One is a+ib where i is the root of -1, which is [B][I][COLOR="Red"]NOT[/COLOR][/I][/B] -1. This is called the Cartesian (or rectangular) coordinate system. The second way is to provide the equivalent hypotenuse of the a and b points (i.e. … | |
Re: >> He is right about HO's mother -- she was white trash. But we can't blame HO for the sins of his parents. Who's HO? | |
Re: There's a joke going around Ireland that goes along these lines... "A police man stops a car that's filled with five guys wearing white robes with hoods. It's late at night and he asks the driver where he's going, to which he responds 'We're going to [URL="http://maps.google.com/maps?num=50&hl=en&safe=off&q=kilbarrack,+dublin,+ireland&ie=UTF8&ll=53.386707,-6.165047&spn=0.02795,0.077248&z=14"]Killbarrack[/URL]'." Made me chuckle … | |
Re: >> and I never really shot anyone with a real gun That vague denial of shooting nobody doesn't fill me with confidence. >> Take the kids to a range. Let 'em shoot. I probably don't believe this, but it's funny[quote]THE BEST COMEBACK LINE for 2007… For those that don’t know … | |
Re: That claims ye're the last remaining superpower... pff. What are national ID cards (past the obvious)? I landed between the 'n' and 't' of the centre... should be noted I didn't read most of the questions and didn't understand the rest. | |
Re: I don't know about a name for the shop, but your caption could be: "Hang the wife. Shoot the family. Frame the kids." I saw it on a shop somewhere else and it stuck. | |
Re: printf().... Oh and include stdio.h instead of iostream. And time.h instead of ctime. Also, C doesn't have references, so you'll have to convert those reference parameters to pointers. Just out of curiosity, why do you want to convert it to C? See [URL="http://cboard.cprogramming.com/showthread.php?t=108187"]here[/URL]. | |
Re: Surely the computer's gonna talk l33t so it can't be distinguished from any other 13 year old girl on the net. Of course it's gonna succeed. | |
Re: I figure the problem might be in declaring a local variable called rowNum while at the same time having a parameter called the same. Also, your function doesn't return anything. For future reference please post the errors/warnings you get too. | |
Re: I think you might have to return a reference/pointer to the stream. Though if it's a local variable you might have to return a dynamically allocated stream. | |
Re: Least you're honest... Good luck with that assignment. | |
Re: Why not? I made it to 2k in another forum and didn't notice until I was at 2050 ish. | |
Re: Why don't you just do [inlinecode]myArray[counterArray] = new unsigned long;[/inlinecode] in the allocation loop? And don't forget to [inlinecode]delete[/inlinecode] everything too! Considering what you basically want is a 50-element array why don't you do [inlinecode]unsigned long *array_50 = new unsigned long[50];[/inlinecode], and then access via the [] operator as per … | |
Re: To copy a file you basically need to first read that file. To do this read about opening ifstreams as binary files ( [url]http://www.cplusplus.com/reference/iostream/istream/read.html[/url] ), might want to edit that code a bit. Then you'll want to save the contents of what you read to an output file, ofstream is … | |
Re: Does [inlinecode]ifstream::get[/inlinecode] read whitespace? I think it can. Use .get() instead of using the >> operator. i.e. [inlinecode]plainVector.push_back( cyphFile.get() );[/inlinecode] | |
Re: What do you mean by three tear? All VC programs must be projects... So open up the program. Go to "File -> New -> Project -> Visual C++ Projects -> Win32 -> Win32 Console Project", or similar. I'm on MSVC '03 so the menu's probably slightly different in whatever one … | |
Re: >> Gee, what more do you want? A clickable link would be nice. I don't want to have to copy and paste again, Salem! | |
Re: If you use [inlinecode]fstream[/inlinecode] you can both read and write to the strem. [url]http://www.cplusplus.com/reference/iostream/fstream/[/url] To be honest, I don't see the point in reinventing the wheel, but what the hey. Why not? |
The End.