User Profile

Collapse

Profile Sidebar

Collapse
sd99
sd99
Last Activity: Feb 10 '16, 06:32 AM
Joined: Feb 7 '16
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • sorry i didnt mention it before but the user enters the word (so i dont need a dictionary)
    getting the code in 1 string is where im going wrong this is what im ending up doing all the time...

    gets(a) //a is an array
    for(int i=0;i<10;++i)
    for(int j=0;j<10;++j)
    b[i][j]=a[i]; /*trying to store it in many lines but this might be where im going wrong*/
    for(i=0...)
    for(j=0...)
    cout...
    See more | Go to post

    Leave a comment:


  • Counting the number of times a word occurs in a 2-D array of strings in C++

    I want to write a function in C++ to accept a 2D array of STRINGS and a word then count the number of times the word occurs in a string.
    Tried different codes but end up with too many errors! Am I supposed to store the 2D array in a 1D array word by word (cant figure out how) or check for the word line by line?
    See more | Go to post

  • sd99
    replied to how to get rid of Illegal structure operation?
    in C
    nvm got it
    corrections: (under main)
    int n, a[10];
    cin>>n;
    for(int i=0;i<n;++i)
    cin>>a[i];
    cout<<is_sorted (a,n)
    getch();
    }
    See more | Go to post
    Last edited by sd99; Feb 7 '16, 03:17 PM. Reason: specifications (under main)

    Leave a comment:


  • sd99
    started a topic how to get rid of Illegal structure operation?
    in C

    how to get rid of Illegal structure operation?

    The question is to write C++ program using a function ( is_sorted() ) which takes a 1-D array and size as arguments, returns 1 if it is in ascending order, -1 if in descending order or else 0.
    I used int* a[10]; as i was getting an error with just int a[10] when calling the function, can anyone explain to me why i need int* and mostly how to get rid of the illegal structure operation?

    This is my code:
    #
    int is_sorted(int...
    See more | Go to post
No activity results to display
Show More
Working...