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 Mike Lewis 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

    I've already solved a problem in a slightly different way #include <string> #include <sstream> #include <iostream> #include <vector> using namespace std; class String { private: std::vector<std::string> data; public: //default constructor String() : data()...
  2. maur3r

    operator &lt;&lt; problem

    Hi I am trying to overload << operator for a simple class class String { private: std::list<std::string> data; public: //some simple functions } ; Unfortunately my approach to overloading << doesn't work inline std::ostream& operator<<(std::ostream& os, const String...
  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

    If you are running on solaris you can try http://courses.cs.tamu.edu/cpsc612/miket/notes/clock.html The other option is to use traditional clock() function. It's obviously less accurate that the ones mentioned by Salem. This is about clock() clock_t start, finish; double duration...
  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

    I am writing an application which is supposed to implement polynomials. It involves dynamic memory allocation, therefore I check it with valgrind. Once I noticed the following problem and I have no idea how to fix it double poly::operator() (const double& value) { double tmp; for(unsigned...
  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

    Hi I heart that for measuring a time of loop execution in nanoseconds struct timespec could be used. However, I didn't find 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()...
  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?

    I am trying to write a program which is going to ask all 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...
  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