Thread: array problem

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    1

    Unhappy array problem

    Code:
    void voltage_measure(void) {
          
       unsigned char Van1[8];
       unsigned char Vbn[8];
       unsigned char Vcn[8];
       unsigned char AB[8];
       unsigned char AC[8];    
      // unsigned int Vab1[8],Vab2[8],Vac1[8],Vac2[8],Vbc1[8],Vbc2[8];
     //  unsigned int Vab[8],Vac[8],Vbc[8];
      // unsigned int i,j; 
       
       Van1[0]=0xF0;   
       Van1[1]=0x00;
       Van1[2]=0x00;                                  
       Van1[3]=0x00;
       Van1[4]=0x00;  
       
       Vbn[0]=0x78;
       Vbn[1]=0x00;
       Vbn[2]=0x00;
       Vbn[3]=0x00;
       Vbn[4]=0x00;
       
       Vcn[0]=0x3C;
       Vcn[1]=0x00;
       Vcn[2]=0x00;
       Vcn[3]=0x00;
       Vcn[4]=0x00;
       
       AB[0]=0x32;
       AB[1]=0x00;
       
       AC[0]=0x2D;
       AC[1]=0x00;
        
      
     /*
       for( i=0;i<4;i++) {
       for(j=0;j<1;j++) {
        
       Vab1[i]=((Vbn[i]*sin(AB[j]))*(Vbn*sin(AB[j])));
       Vab2[i]=(Van1[i]+(Vbn[i]*cos(AB[i])))*(Van1[i]+(Vbn[i]*cos(AB[i])));
       Vab[i]=sqrt(Vab1+Vab2); 
       
       
       Vac1[i]=(Vcn[i]*sin(AC[i]))*(Vcn[i]*sin(AC[i]));
       Vac2[i]=(Van1[i]+(Vcn[i]*cos(AC[i])))*(Van1[i]+Vcn[i]*cos(AC[i]));
       Vac[i]=sqrt(Vac1[i]+Vac2[i]);
       
       Vbc1[i]=(Vcn*sin(BC))*(Vcn*sin(BC));
       Vbc2[i]=(Vbn[i]+(Vcn[i]*cos(BC[j])))*(Vbn[i]+(Vcn[i]*cos(BC[j]))) ;
       Vbc[i]=sqrt(Vbc1[i]+Vbc2[i]);
       
      
       
       }  
       }
        */
       }/co
    actually i have a problem how to put array character into the formula...the array with 8 bytes ,what i'm supposed to do to make sure the character get into the formula
    Last edited by kiki_lala; 08-05-2009 at 09:22 PM. Reason: very implicit information

  2. #2
    C++11 User Tux0r's Avatar
    Join Date
    Nov 2008
    Location
    Sweden
    Posts
    135
    Quote Originally Posted by kiki_lala View Post
    Code:
    void voltage_measure(void) {
          
       unsigned char Van1[8];
       unsigned char Vbn[8];
       unsigned char Vcn[8];
       unsigned char AB[8];
       unsigned char AC[8];    
      // unsigned int Vab1[8],Vab2[8],Vac1[8],Vac2[8],Vbc1[8],Vbc2[8];
     //  unsigned int Vab[8],Vac[8],Vbc[8];
      // unsigned int i,j; 
       
       Van1[0]=0xF0;   
       Van1[1]=0x00;
       Van1[2]=0x00;                                  
       Van1[3]=0x00;
       Van1[4]=0x00;  
       
       Vbn[0]=0x78;
       Vbn[1]=0x00;
       Vbn[2]=0x00;
       Vbn[3]=0x00;
       Vbn[4]=0x00;
       
       Vcn[0]=0x3C;
       Vcn[1]=0x00;
       Vcn[2]=0x00;
       Vcn[3]=0x00;
       Vcn[4]=0x00;
       
       AB[0]=0x32;
       AB[1]=0x00;
       
       AC[0]=0x2D;
       AC[1]=0x00;
        
      
     /*
       for( i=0;i<4;i++) {
       for(j=0;j<1;j++) {
        
       Vab1[i]=((Vbn[i]*sin(AB[j]))*(Vbn*sin(AB[j])));
       Vab2[i]=(Van1[i]+(Vbn[i]*cos(AB[i])))*(Van1[i]+(Vbn[i]*cos(AB[i])));
       Vab[i]=sqrt(Vab1+Vab2); 
       
       
       Vac1[i]=(Vcn[i]*sin(AC[i]))*(Vcn[i]*sin(AC[i]));
       Vac2[i]=(Van1[i]+(Vcn[i]*cos(AC[i])))*(Van1[i]+Vcn[i]*cos(AC[i]));
       Vac[i]=sqrt(Vac1[i]+Vac2[i]);
       
       Vbc1[i]=(Vcn*sin(BC))*(Vcn*sin(BC));
       Vbc2[i]=(Vbn[i]+(Vcn[i]*cos(BC[j])))*(Vbn[i]+(Vcn[i]*cos(BC[j]))) ;
       Vbc[i]=sqrt(Vbc1[i]+Vbc2[i]);
       
      
       
       }  
       }
        */
       }/co

    how to put an array into the formula
    Sorry, but you are going to have to be more specific.

  3. #3
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    If I understood your question correctly, what you've done in the commented part is perfectly fine, I mean you can use array elements as arguments to trigonometrical functions. But please be more specific next time.
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Array problem
    By TomBoyRacer in forum C++ Programming
    Replies: 3
    Last Post: 04-08-2007, 11:35 AM
  2. Class Template Trouble
    By pliang in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2005, 04:15 AM
  3. Replies: 6
    Last Post: 02-15-2005, 11:20 PM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. Need desperate help with two dimensional array problem
    By webvigator2k in forum C++ Programming
    Replies: 4
    Last Post: 05-10-2003, 02:28 PM