Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: maur3r
  • Order by date
  1. maur3r

    operator << problem

    ...//default constructor String() : data() { } //conversion constructor for string literals String(const char *str) : data() { data.push_back(str); } //copy constructor String(const String &str) {...
  2. maur3r

    operator << problem

    ...&str) { std::list<std::string>::iterator idx; idx=(str.data).begin() ; //for(idx=str.data.begin(); idx!=str.data.end(); ++idx) os<<*idx<<endl; return os; } The error is as following error: no match for ‘operator=’ in ‘idx = str->String::data. std::list<_Tp, _Alloc>::begin...
  3. maur3r

    operator [][] overloading

    Yes but unfortunately I have to create my project compatible with an interface where indexing operator is declared in the way [rows][cols] Regards, Martin (OS and comp.) using Linux and gcc
  4. maur3r

    operator [][] overloading

    I don't quite follow the presented option. Would you mind giving a simple example? I would very much appreciate. Regards, Martin (OS and comp.) using Linux and gcc
  5. maur3r

    operator [][] overloading

    I wrote a class "matrix" which uses **double. I am trying to write an operator [][] for this class to be able to perform f.ex matrix A; A[1][1]=2; Does anybody know how to overload such operator? Regards, Martin (OS and comp.) using Linux and gcc
  6. maur3r

    Accessing a matrix

    I guess that might help a bit #include <stdio.h> #include <stdlib.h> int main() { int i; int ** matrix; /*ex 3x3*/ int *copy; matrix=malloc(3*sizeof(int*)); for(i=0;i<3;i++) matrix[i]=malloc(3*sizeof(int)); /*copy of 3 row*/ copy=matrix[2]; } Regards, Martin (OS and comp.) using Linux and gcc
  7. maur3r

    hi resolution timer questions

    ...It's obviously less accurate that the ones mentioned by Salem. This is about clock() clock_t start, finish; double duration; start=clock(); /* your loop */ finish=clock(); duration=(double)(finish -start)/CLOCKS_PER_SEC; Also here are some links to similar topics...
  8. maur3r

    Dummy question

    Now I see it clearly. Thank you Regards, Martin (OS and comp.) using Linux and gcc
  9. maur3r

    Dummy question

    Can somebody please tell me why the first code works and second not (of course the only difference is changing type of i var. from int to unsigned int) and maybe evaulate a solution how to change a first code using unsigned type and not receive an error. int a[3]; a[0]=0; a[1]=1; a[2]=2...
  10. maur3r

    overloading problem

    In my code *values are initialized in following way double *values = new double[degree+1]; But when I initialize tmp in following way double tmp=0; everything works fine. It's pretty amazing how little things can destroy the whole code :) I want to thank both of you for interest and especially...
  11. maur3r

    overloading problem

    ...and I have no idea how to fix it double poly::operator() (const double& value) { double tmp; for(unsigned i=0;i<=degree;i++) tmp+=values[i]*value; return tmp; } ostream & operator << (ostream & o, const poly & p) { for (unsigned i=0;i<=p.degree;i++){ o << p[i]; o <<...
  12. maur3r

    timespec structure

    My OS is Mandrake and I am using gcc. In the meantime I found another function http://courses.cs.tamu.edu/cpsc612/miket/notes/clock.html Unfortunately it doesn't work under my OS, but I've checked it under Solaris and seems to work fine. Anyway, thank you very much for your comments and...
  13. maur3r

    timespec structure

    ...any info how to implement it into C code. I am wondering if it works more or less the same as clock() function int s,f; float time; s=clock(); /*loop*/ f=clock(); time=(f-s)/CLOCKS_PER_SEC or maybe totally different. Also what libraries should I include. I am pretty sure that <unistd.h>...
  14. maur3r

    Timing a loop in microseconds

    You can use clock() function from <time.h> clock_t start, finish; double duration; start=clock(); /* your loop */ finish=clock(); duration=(double)(finish -start)/CLOCKS_PER_SEC; If someone knows other (maybe more accurate) way to measure loop execution time, I will appreciate it cause I am...
  15. maur3r

    how to hide text in the console?

    Thank you Salem. It helped a lot. Martin
  16. maur3r

    how to hide text in the console?

    My OS is Mandrake. I am not using separate compiler just standard gcc. Martin
  17. maur3r

    how to hide text in the console?

    ...users for password. It will be a console application. I am curius if there exists a function which can modify output of a console in such way: $./a.out $Enter password $******* /*We are entering f.ex tektips (7 letters) but on the screen we see 7 stars*/ Thanks in advance for any help. Martin
  18. maur3r

    A trivial question?

    The solution to ""modify"" the content of * is to allocate memory for it. (functions malloc, calloc, realloc). Personaly I prefer this solution because you don't have to declare size of the array before compilation and can increase it dynamically. char *bar; char *tmpbar; bar=malloc(10/*any...
  19. maur3r

    atoi problem

    Obviously. Thank you xwb!!!!! #include <stdio.h> #include <string.h> #include <stdlib.h> int main() { char *data; int i,r; data=malloc(11*sizeof(char)); for (i=0;i<10;i++) data[i]='1'; data[10]='\0'; r=atoi(data); free(data); return 0; } This unfortunately proves how lame I am and how careful...
  20. maur3r

    atoi problem

    I am sorry it was a misprint. Atoi is before return O r=atoi(data); return 0; Martin

Part and Inventory Search

Back
Top