Forum: C++ Oct 16th, 2009 |
| Replies: 6 Views: 335 Actually I figured it out. ctrl+d in linux and ctrl+z in windows! |
Forum: C++ Oct 16th, 2009 |
| Replies: 6 Views: 335 Just out of curiosity, how do you stop the while loop with control+z?
--drjay |
Forum: C++ Oct 16th, 2009 |
| Replies: 17 Views: 434 so a newbie:
start here
#include <bitset>
#include <cstdlib>
int main(){
// you will need some sort of a loop |
Forum: C++ May 1st, 2009 |
| Replies: 9 Views: 324 Is this your output or this this how the output should look like? |
Forum: C++ May 1st, 2009 |
| Replies: 9 Views: 324 I think you are not cout-ing properly. Copy-paste the entire output or exactly which cout statement out do you have here? |
Forum: C++ May 1st, 2009 |
| Replies: 3 Views: 308 3000 lines? are they all in main()? If that is the case that is your 1st problem. 3000 lines or 30,000 lines want matter if you break the code down.
Get into the habit of writing smaller methods.... |
Forum: C++ Apr 25th, 2009 |
| Replies: 6 Views: 429 I actually fixed it. The fault was at the client end. worked on it for about 5 hours!
The read function in the client read in a char array of a fixed size. when the write from the server is... |
Forum: C++ Apr 24th, 2009 |
| Replies: 1 Views: 391 I'm looking for some help resolving the following warning...
warning: format ‘%c’ expects type ‘char*’, but argument 6 has type ‘char (*)[128]’
char data [ BLOCK_SIZE ];
sscanf ( inBuf,... |
Forum: C++ Apr 24th, 2009 |
| Replies: 2 Views: 779 |
Forum: C++ Apr 24th, 2009 |
| Replies: 2 Views: 779 int c, s;
sscanf ( inBuf, " %d %d", &c, &s );
I wanna check if c and s are actually int.
suppose if you enter a letter rather than a number, how do i check? |
Forum: C++ Apr 24th, 2009 |
| Replies: 6 Views: 429 its server not sever... that was a typo.
char outBuf[128];
int cylinders, sectors, client_sockfd;
sprintf ( outBuf, "cylinder: %d Sector: %d\n", cylinders, sectors );
write ( client_sockfd,... |
Forum: C++ Apr 24th, 2009 |
| Replies: 6 Views: 429 when the sever out put to the client, how do i get the whole stream rather than just part of it? |
Forum: C++ Apr 24th, 2009 |
| Replies: 6 Views: 429 I doing this server and client program. The sever has to output to the client.
strcpy ( outBuf, " " );
sprintf ( outBuf, "cylinder: %d Sector: %d\n", cylinders, sectors );
if ( write... |
Forum: C++ Apr 11th, 2009 |
| Replies: 3 Views: 920 can someone please explain to me how read write work in sock programming.
my assignment is to run a server and client. the client ask the server "who are you?" and the server replies with the... |
Forum: C++ Mar 28th, 2009 |
| Replies: 2 Views: 882 Hello,
Is there any way of checking all elements in a queue without calling pop().
while(!q.empty()){
cout << q.front() << endl;
q.pop()
} |
Forum: C++ Mar 27th, 2009 |
| Replies: 2 Views: 289 |
Forum: C++ Mar 27th, 2009 |
| Replies: 2 Views: 289 if we use queue from c++ stl, we don't need
//void enqueue(struct queue *q, int a)
//int dequeue(struct queue *q)
functions?
my TA has it on the slides but since the c++ queue has push... |
Forum: C++ Mar 27th, 2009 |
| Replies: 3 Views: 385 just out of curiosity (definitely not because i have a deadline tonight lol) how does a plagiarism detecting software work? any ideas?
i'm pretty sure the program compares run time...
for... |
Forum: C++ Feb 8th, 2009 |
| Replies: 5 Views: 409 thanks...
how do you print 90 degrees?
side2 = (side1) / (tan(angle1*PI/180));
side3 = (side1) / (sin(angle1*PI/180));
angle2 = (atan... |
Forum: C++ Feb 8th, 2009 |
| Replies: 5 Views: 409 hey,
given one side and an angle how do you calculate the other sides and angles in a right angle triangle in c++.
I'm basically looking for an algorithm.
Thanks
drjay |
Forum: C++ Nov 30th, 2008 |
| Replies: 3 Views: 1,716 i figured it out! thanks! |
Forum: C++ Nov 30th, 2008 |
| Replies: 3 Views: 1,716 there are two maps.
_fileMap<string,string> and the other is _freqMap<string, int>
_freqMap works fine but _fileMap doesn't. I don't think typedef will work here. I'll try it though. |
Forum: C++ Nov 30th, 2008 |
| Replies: 3 Views: 1,716 I need help with inserting a string for both key and value to a map.
while(!myHuffFile.eof()){
string word, code;
int freq;
myHuffFile >> word >> freq >> code;
if(word == ""){... |
Forum: C++ Nov 30th, 2008 |
| Replies: 1 Views: 993 I have string and a map<string,int>
i need to iterate through the map and find string[i] and replace the int with the string.
eg: if map contains
hello 6
world 4
its 3
me 60 |
Forum: C++ Nov 24th, 2008 |
| Replies: 6 Views: 430 I replied the before I read you solution. Didn't expect a quick response. Sorry mate!
I still have the same problem though! Need to figure out a way to edit an existing file rather than create a... |
Forum: C++ Nov 24th, 2008 |
| Replies: 6 Views: 430 yeah it creates a output file each time the function is called. the way i have it setup i need a recursive function. |
Forum: C++ Nov 24th, 2008 |
| Replies: 6 Views: 430 figure out the problem! this is a recursive function... |
Forum: C++ Nov 24th, 2008 |
| Replies: 6 Views: 430 I encode a text file using a huffman tree. Which print out to the screen and and output to a file. File only contains the last line that prints to the console.
void traverse(string code = "")... |
Forum: C++ Nov 23rd, 2008 |
| Replies: 3 Views: 952 void createInputFileForHuffman();
int main () {
createInputFileForHuffman();
return 0;
}
void createInputFileForHuffman(){
bool flag = false; |
Forum: C++ Nov 22nd, 2008 |
| Replies: 3 Views: 952 Can some one help me with this error:
=========================================error================================
In file included from /usr/include/sys/signal.h:34,
from... |