Posts
 
Reputation
Joined
Last Seen
Ranked #121
Strength to Increase Rep
+15
Strength to Decrease Rep
-3
89% Quality Score
Upvotes Received
286
Posts with Upvotes
252
Upvoting Members
160
Downvotes Received
39
Posts with Downvotes
34
Downvoting Members
21
75 Commented Posts
~699.47K People Reached
Favorite Tags
Member Avatar for vegaseat

The difference between a democracy and a dictatorship is that in a democracy you vote first and take orders later; in a dictatorship you don't have to waste your time voting. Charles Bukowski

Member Avatar for Reverend Jim
15
13K
Member Avatar for adoleh

You have some fundamental problems with your code especially the lack of a proper formating scheme..Also please use code tags. [code] #include <iostream> using namespace std; int main() { int num; cout << "Enter a two-digit number:\n"; cin >> num; int ones_digit = num%10;//preform these operations int tens_digit = num/10;//after …

Member Avatar for emsmary
0
16K
Member Avatar for GadiK

Here's a quick example of a parent receiving from a child which receives from a child...It should be 'mostly' correct. [CODE] #include <stdio.h> #include <stdlib.h> #include <unistd.h> enum PIPES {READ, WRITE}; int main(int argc, char**argv) { int hpipe[2]; pipe(hpipe); if (fork()) { /*parent*/ char ch; close(hpipe[WRITE]); dup2(hpipe[READ], 0); close(hpipe[READ]); while …

Member Avatar for Riadh_1
0
11K
Member Avatar for munitjsr2

Really, why would you want to? You know that some of the binary characters have no ascii representation, hence can't be displayed. It would be better to display each binary value in hex, thus displaying each and everyone of them.

Member Avatar for AssertNull
0
3K
Member Avatar for tegaelam

Instead of starting at zero and incrementing try starting at columns value and decrementing to zero..

Member Avatar for Reverend Jim
0
3K
Member Avatar for cpsusie

Measuring execution time is a very complex task...just check the link titled [pdf]Measuring Program Execution Time [url]http://www.google.ca/#hl=en&source=hp&q=linux+execution+time&btnG=Google+Search&meta=&aq=1&oq=linux+execu&fp=7e102d89cbdc458f[/url]

Member Avatar for Zack_7
0
11K
Member Avatar for kylcrow
Member Avatar for pavankumar77

[CODE] #include <iostream> unsigned int addone(unsigned int x) { unsigned int y = 0; unsigned int z = 0; for (int i = 0; i <= 31; ++i) { z = (x<<(31 - i))>>31<<(i); if (z > 0) { x = x ^ z; } else { y = x|0xffffffff; …

Member Avatar for pritaeas
0
616
Member Avatar for Dave Sinkula

In my very limited view of C++, I find Accelerated C++ and Ruminations on C++ very beneficial to the newest C++'ers. Its such a great introduction to the understanding of the principles of the language. Thank-you Andrew Koenig and Barbara Moo..I appreciated yours words of wisdom.

Member Avatar for shahidali6
11
10K
Member Avatar for LostnC

For starters, you might want to move this above the main() function like: [CODE] void swap(int *, int *); //prototype with a pointer parameter int main() { ... } [/CODE]

Member Avatar for deceptikon
0
3K
Member Avatar for Jfunch

Try creating a pipe. Here's a simple example. [code] #include <iostream> #include <unistd.h> enum PIPES {READ, WRITE}; int main(int argc, char**argv) { int hpipe[2]; pipe (hpipe); if (fork()) { close (hpipe[WRITE]); int x = 0; while (true) { read (hpipe[READ], (char*)&x, sizeof(int)); if (x < 0) break; std::cout<<"child recieved->"<<x<<"\n"; } …

Member Avatar for Kyle_4
0
3K
Member Avatar for gerard4143

I have a simple question about unicode and utf8. How does a utf8 encoding know what its uppercase encoding is? I understand how utf8 encoding carries its unicode value embedded in itself but I fail to see how it maps a utf8 encoding to an uppercase unicode value. What is …

Member Avatar for deceptikon
0
158
Member Avatar for Vandithar
Member Avatar for maha harshini
0
389
Member Avatar for inspire_all

Line 27 should be: [code] c.str[m]=' '; [/code] Line 29 should be: [code] for(int len=m+1;(*b.str)!='\0';len++) [/code] This is how I would solve it: [code] class string { public: char& operator[](int offset); const char& operator[](int offset) const; friend string operator+(const string & lhs, const string & rhs); }; const char& string::operator[](int …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for Shreerang
Member Avatar for inspire_all

How can i do it? Depends. Do you want to overwrite the characters or do you want to insert the characters and shift everything down..

Member Avatar for naveen1993
0
199
Member Avatar for Rallici

[QUOTE=Rallici;1465475]I aint ganna lie. I have no clue how to attempt this I have read about it online but every time i attempt to i fail miserably.[/QUOTE] I would delete the compiler/IDE and then reinstall it.

Member Avatar for learner_new
0
2K
Member Avatar for taverasme

Try something like below: [CODE] #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char inputstr[128]; char *cptr = &inputstr[0]; size_t thesize = 128; while(1) { if(feof(stdin) != 0) { break; } getline(&cptr, &thesize, stdin); printf("input string is : %s\n", inputstr); } getc(stdin); return 0; } [/CODE]

Member Avatar for Nikolas9896
0
6K
Member Avatar for fahadmunir32
Member Avatar for baid.arham619

I think you are confused. First you write the program and then you post it with any problems you are having.

Member Avatar for samson.dadson.3
0
268
Member Avatar for radu.nuconteaza
Member Avatar for nhrnjic6

The solution or hints of a solution depend on which data structures you plan to use. Could you post what you have so far?

Member Avatar for nhrnjic6
0
150
Member Avatar for karma2you

I have a question about this line scanf("%d", &val); Why are you reading a integer into a character? Won't it make more sense to read the characters directly into the character array? scanf("%20s", a);

Member Avatar for Ancient Dragon
0
241
Member Avatar for Pia_1
Member Avatar for deceptikon
0
200
Member Avatar for Ahtsham

Well 3 divided by 5 has 3 left over. The modulus operator computes the remainder of integer division.

Member Avatar for richieking
0
178
Member Avatar for Fedoros

I guess you are not aware of our homework policy. We don't do homework problems. If you want help with a specific problem then you'll have to post the code and indicate exactly where and what the problem is.

Member Avatar for Fedoros
0
118
Member Avatar for CreatorZeus

You can set the delimiter for getline(). istream& getline (istream& is, string& str, char delim); Please check out this link http://www.cplusplus.com/reference/string/string/getline/

Member Avatar for deceptikon
0
255
Member Avatar for hemanshurpatel
Member Avatar for samer.aboufakher.3

You seem to be missing the opening brace here void toss(int & x)//missing brace here //0=heads 1=tails x=rand()%2;

Member Avatar for samer.aboufakher.3
0
183
Member Avatar for roshan.parate.73