Search:

Type: Posts; User: Tupcia

Search: Search took 0.00 seconds.

  1. Thread: Counting shapes

    by Tupcia
    Replies
    1
    Views
    1,926

    Counting shapes

    I have couple of text files with some drawn shapes made of . and +
    for example:


    I am reading this text file info an 2D array.
    Looking at the example I see 4 shapes made of +

    But how how can...
  2. Thread: Vector -> int

    by Tupcia
    Replies
    8
    Views
    2,998

    Swoopy: That is not the actual program, but a...

    Swoopy:
    That is not the actual program, but a quick sample showing the problem, I typed it fast here, and I forgot to place "<<"

    anyway here is my actual program, now I am passing the vector by...
  3. Thread: Vector -> int

    by Tupcia
    Replies
    8
    Views
    2,998

    Vector -> int

    #include <cstdlib>
    #include <iostream>
    #include <vector>

    using namespace std;

    void print(vector <int> *xxx);

    int main(){
    vector <int> xxx;
  4. Replies
    6
    Views
    2,271

    I am trying to get time complexity ( Big O of N)...

    I am trying to get time complexity ( Big O of N)
    For heap sort it should be O(N*log(N))

    Now I realized that the title of the thread is somewhat missleading
  5. Replies
    6
    Views
    2,271

    # of steps in sort

    I am trying to see how many steps it will take to sort a set of ints via heap sort.


    // x = how many random ints were generated
    int z = 0;
    for(int k=x;k>0;k–-){
    for(int i=1;i<=k;i++){
    ...
  6. Replies
    4
    Views
    2,694

    Array -> 2D array

    How can I convert an array of 25 elements into a 5x5 2D array?
  7. Thread: read() -> array

    by Tupcia
    Replies
    4
    Views
    1,572

    int x, y,z; char arr[5][5]; for ( x = 0; x

    int x, y,z;
    char arr[5][5];

    for ( x = 0; x < 5; x++){
    for ( y = 0; y < 5; y++){
    z=read(pipe, buf, PIPE_BUF);
    arr[x][y] = z;
    printf("%c%c", arr[x][y]);
    }
    printf("\n");
  8. Thread: read() -> array

    by Tupcia
    Replies
    4
    Views
    1,572

    read() -> array

    This gets char array sent via pipe to a second process and prints it:


    int x;
    int pipe;
    char buf[PIPE_BUF];
    while ((x=read(pipe, buf, PIPE_BUF))>0)
    write(fileno(stdout), buf, x);
  9. Thread: Parsing strings

    by Tupcia
    Replies
    19
    Views
    2,986

    Got it, by breaking the string into tokens: ...

    Got it, by breaking the string into tokens:



    vector <string> text;

    char input = "a.ds.ees.f.csg.cw.s.ab.s.f.s.ffsd.j" ;

    char *a;
    a = strtok(input, ".");
  10. Thread: Parsing strings

    by Tupcia
    Replies
    19
    Views
    2,986

    vector text; string input =...

    vector <string> text;

    string input = "a.ds.ees.f.csg.cw.s.ab.s.f.s.ffsd.j" ;

    int j = 0;
    for (int i=0;i < input.length(); i++){
    if(isalpha(input[i]))
    ...
  11. Thread: Parsing strings

    by Tupcia
    Replies
    19
    Views
    2,986

    but when I do that it places every char into a...

    but when I do that it places every char into a seperate element, and I want to group them

    insted of [a][d][s][e][e] ... I want [a][ds][ees] ...
  12. Thread: Parsing strings

    by Tupcia
    Replies
    19
    Views
    2,986

    Thanks for the idea. Now what is wrong with...

    Thanks for the idea.
    Now what is wrong with program it crashes;




    vector <string> text;

    string input = "a.ds.ees.f.csg.cw.s.ab.s.f.s.ffsd.j" ;
  13. Thread: Parsing strings

    by Tupcia
    Replies
    19
    Views
    2,986

    Parsing strings

    I have a string of letters seperated by periods, like this:

    I want to place each set of letters into a element of an array, so it would look something like:

    Can you guys give me an idea on how...
  14. Replies
    1
    Views
    989

    Concatination of chars

    I am having trouble concatenating 2 chars


    char a = 'a';
    char b = 'b';
    strcat (a,b);
    cout << a;


    what is the proper way of doing something like this?
  15. Replies
    8
    Views
    2,218

    Cool BIG thanks for the help!

    Cool BIG thanks for the help!
  16. Replies
    8
    Views
    2,218

    How can I do this? Or could someone please...

    How can I do this?

    Or could someone please point me to a good tutorial.

    Thanks
  17. Replies
    8
    Views
    2,218

    Global array - size

    How can I declare a global array whose size I calculate in a function later on (based on # of rows & columns of terminal ).



    // global vars
    int row, col;
    char box[row][col]; // causes error...
  18. Replies
    1
    Views
    1,079

    Returning file descriptors

    I am having trouble returning a file descriptor to main and calling a 2nd function there passing the returned file descriptor as paramater.


    FILE *file_des;
    FILE x;

    FILE input(char* title){...
  19. Replies
    3
    Views
    2,392

    cool, so I can place any number as the second...

    cool, so I can place any number as the second dimension ?
  20. Replies
    3
    Views
    2,392

    passing 2d array to function

    I am having trouble passing an 2d array to a function:


    int sum (char ar[][], int i, int j){ // line 20
    int x=0;
    if (ar[i][j] == 'a')
    x++;
    if (ar[i][j] == 'b')
    x+=2;
    if...
  21. Replies
    1
    Views
    1,145

    Updating 2d array

    // fill
    for (int i=0; i<10;i++)
    for (int j=0; j<10;j++)
    square[i][j]= '0';

    // update
    square[1][1]= '4';
    square[3][4]= '1';
    square[7][7]= '7';
  22. Thread: Delete letter

    by Tupcia
    Replies
    0
    Views
    956

    Delete letter

    I am having problems with erasing a letter, what is wrong?



    struct termios input;
    input.c_flag &= ~ISIG;
    input.c_flag &= ~ICANON;
    FILE *point;
    tcsetattr(fileno(point),TCSANOW,&input);
Results 1 to 22 of 23