- Strength to Increase Rep
- +15
- Strength to Decrease Rep
- -3
- Upvotes Received
- 286
- Posts with Upvotes
- 252
- Upvoting Members
- 160
- Downvotes Received
- 39
- Posts with Downvotes
- 34
- Downvoting Members
- 21
Re: 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 | |
Re: 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 … | |
Re: 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 … | |
Re: 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. | |
Re: Instead of starting at zero and incrementing try starting at columns value and decrementing to zero.. | |
Re: 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] | |
Re: Has anyone checked the date of this posting...Apr 6th, 2007 | |
Re: [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; … | |
Re: 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. | |
Re: 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] | |
Re: 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"; } … | |
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 … | |
Re: It would probably help if you disclosed which Windows and what error.. | |
Re: 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 … | |
Re: Sure just type firefox [url]www.google.com[/url] | |
Re: 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.. | |
Re: [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. | |
Re: 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] | |
Re: Or posting in the wrong section? | |
Re: I think you are confused. First you write the program and then you post it with any problems you are having. | |
Re: Ok, which functions and line numbers are you talking about? | |
Re: The solution or hints of a solution depend on which data structures you plan to use. Could you post what you have so far? | |
Re: 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); | |
Re: Shouldn't this scanf("%s", &employeeIDNew); be scanf("%s", employeeIDNew); | |
Re: Well 3 divided by 5 has 3 left over. The modulus operator computes the remainder of integer division. | |
Re: 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. | |
Re: 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/ | |
Re: You seem to be missing the opening brace here void toss(int & x)//missing brace here //0=heads 1=tails x=rand()%2; | |
Re: OK. What have you tried so far? |