User Profile

Collapse

Profile Sidebar

Collapse
mingke
mingke
Last Activity: Jun 7 '09, 01:12 PM
Joined: Dec 13 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • mingke
    started a topic input and output file (txt file)
    in C

    input and output file (txt file)

    Hi...
    I've been trying to make a program where the input is txt file, and the output will be saved in txt file. But, I keep getting error Message.
    My code looks like this:
    Code:
    #include <stdlib.h>
    #include <stdio.h>
    
    int main (){
        int i,j;
        float H [100][100];
    
    FILE*in;
    in=fopen("0.txt","rt");
    FILE*out;
    out=fopen("rotation0.txt","w");
    ...
    See more | Go to post

  • mingke
    replied to Floor and ceil function
    in C
    I have tried another way. I declared an array (arr[5]) and use ceil and floor function. If the number is not zero, the result came out fine, but if the number is zero the result came out not fine. Because sometime it right but for another array,it results 1.000
    My code looks like this;
    Code:
    # include <math.h> 
    int main(){
    float arr[5],c[5];
    int i;
    
    arr[0]=-2.828427; arr[1]=-0.707107; arr[2]=0.000000;arr[3]=-0.707107;
    ...
    See more | Go to post

    Leave a comment:


  • mingke
    started a topic Floor and ceil function
    in C

    Floor and ceil function

    I've learned that we can round up and down a float number by using Ceil and floor function. But, is this function still able to work if I the number I want to round up (or down) is zero?
    I have wrote my codes, but somehow it didn't give the right answer if the number is zero. My simple code looks like this:

    Code:
    #include <math.h> 
    int main(){
    
    printf("The nearest integer from %f is %f\n",
    ...
    See more | Go to post

  • mingke
    replied to Max and Minimum value in arrays
    in C
    Thank you, Jos..

    That solve my problem...
    See more | Go to post

    Leave a comment:


  • mingke
    started a topic Max and Minimum value in arrays
    in C

    Max and Minimum value in arrays

    I tried to find max and min value from arrays. and my code so far looks like this:

    Code:
    for (i=0; i<size2; i++){
      	    for (j = 0; j < 4; j++){
                by_max[i]=by[i][0];
                    if (by[i][j]>by_max[i]){
                        by_max[i]=by[i][j];
                    }
                by_min[i]=by[i][0];
                  if (by[i][j]<by_min[i]){
    ...
    See more | Go to post

  • mingke
    started a topic What's wrong with my Do While Condition?
    in C

    What's wrong with my Do While Condition?

    If for example I have four arrays (with different value), and I have another array which is the result of calculation between these four arrays. Then, I can sort the final array to ascending order and I want to search from the four arrays that can result the sorted final array...

    I used do while loop but I guess something wrong with it because it keep resulting 0.

    Here's my a part of code which has problem:
    ...
    See more | Go to post

  • mingke
    replied to What's wrong with my if loop??
    in C
    Thank you for correcting my mistake and my codes...

    It's working fine now...
    See more | Go to post

    Leave a comment:


  • mingke
    started a topic What's wrong with my if loop??
    in C

    What's wrong with my if loop??

    Hi...

    So I have problem with my if condition..I don't know what's wrong but it keeps resulting the wrong answer....

    So here's the part of my code I have problem with:

    Code:
     for (i=0; i<size2; i++){          
          for (k = 0; k < point3[i]; k++){       
               for (a=0;a<b[i][k];a++){
                  if (90<sudut [i][k][a]<=180){
    ...
    See more | Go to post

  • mingke
    started a topic How to sort array and eliminate duplicate array?
    in C

    How to sort array and eliminate duplicate array?

    Hi...

    I'm having some difficulties to sort two different array (say X and Y), these arrays state the coordinate in x and y axis..so, if X change, Y has to change.

    I have unsorted array and I want to eliminate array with the same value...

    Here's my code which doesn't work:

    Code:
     
    #include <stdlib.h>
    #include <math.h>
    #include <stdio.h>
    #include <conio.h>
    ...
    See more | Go to post

  • mingke
    replied to Array subscription
    in C
    @newb16

    thanks for your respond....

    But how about S[i][l][e]?
    I declared it with three index and use it with three index too....
    Same things happen if I declared R with three index...

    Is it possible because e contains Lx[i] and somehow I declared it wrong?
    See more | Go to post

    Leave a comment:


  • mingke
    replied to Array subscription
    in C
    Sorry...
    I cut my code because it is so long...
    Here my complete code (although I cut a few part)
    Code:
    #include <stdlib.h>
    #include <math.h>
    #include <stdio.h>
    #include <conio.h>
    
    #define size 2
    #define size2 size*size
    #define point1 (size+1)
    #define point2 (size+1)*(size+1)
    #define rotation 45
    #define deg rotation*3.14159265/180
    ...
    See more | Go to post

    Leave a comment:


  • mingke
    started a topic Array subscription
    in C

    Array subscription

    Hi....

    I have a problem with my declaring my array. I just keep getting message like this:
    invalid types `float[9][float]' for array subscript

    Here my code:
    Code:
    #define size 2
    #define size2 size*size
    #define point2 (size+1)*(size+1)
    int main ( )
    {
    float ax[size2][24],ay[size2][24]; 
    float R[size2][point2],S[size2][24][point2]; 
    float e;
    for (i=0;
    ...
    See more | Go to post

  • mingke
    started a topic List coordinates
    in C

    List coordinates

    Hi....

    I'm having difficulties with my codes to list coordinates (in my example codes is 4x4 pixel). I tried two different codes and the results are different.Basic ally, I tried to declare the sub coordinates for x and y, and then print it. But, if I make a change by declaring sub coordinates for x and print it, and the declare sub coordinate for y and print it, the results are different.
    I have tried to calculated manually, the...
    See more | Go to post
    Last edited by pbmods; Feb 8 '09, 09:37 PM. Reason: Added CODE tags.

  • mingke
    replied to Create matrix from txt file
    in C
    Thanks.
    I don't know what is wrong, but these codes aren't working. It's said: `putpixel' cannot be used as a function

    I'm so stupid, so I really need your help...
    See more | Go to post

    Leave a comment:


  • mingke
    replied to Create matrix from txt file
    in C
    Because these are grey scale images. So each pixel has one single numeric value (0-225)....
    See more | Go to post

    Leave a comment:


  • mingke
    started a topic Create matrix from txt file
    in C

    Create matrix from txt file

    I have some images 100x100 pixels and save the value of pixels in *.txt file.

    I have to use this txt files as input for iteration. But I don't know how to make the code to recognize the numbers in txt file as a matrix, and iterate it with another txt file. In txt file, the numbers actually lined up as 100 columns and 100 rows. How to make for example A.txt as input for matrix A, and the number in the first column and the first...
    See more | Go to post
No activity results to display
Show More
Working...