cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/22/18:39:38.1

Message-ID: <EoaTPHDhUPq2EwC8@xemu.demon.co.uk>
Date: Fri, 22 Jan 1999 22:01:05 +0000
To: djgpp AT delorie DOT com
From: Dave Bird <dave AT xemu DOT demon DOT co DOT uk>
Subject: Re: Some newbie Question?
References: <005101be4515$5b574bb0$293f8589 AT GV015029 DOT nera DOT no>
<36A73865 DOT 766DD073 AT mbox2 DOT singnet DOT com DOT sg>
In-Reply-To: <36A73865.766DD073@mbox2.singnet.com.sg>
MIME-Version: 1.0
X-Mailer: Turnpike (32) Version 4.01 <dQumtnY$x4rJ2u5tL5fS$n2vuP>
Reply-To: djgpp AT delorie DOT com

In article <36A73865 DOT 766DD073 AT mbox2 DOT singnet DOT com DOT sg>,
| õ¿õ | õ¿õ | õ¿õ | õ¿õ | <cdman AT mbox2 DOT singnet DOT com DOT sg> writes
>hi there,
>            I just started to learn C++ programming coz it was a module of my
>course of study. I know that my questions maybe a bit out of the list, but I
>hoped that someone would be kind enough to help me.
>
>1. Can anyone recommend any book on C++ which you have read and think that it 
>is
>good??? coz my school only provide notes for the basic, but i want to go 
>further
>in programming.

 Unfortunately I can't.  The original Kernighan & Ritcie book on 'C'
 language is actually very good, but I picked up the conversion to
 C++ from various places whose names I can't remember.

>
>2. I has a mini-project which i need to pass up in two week time, but i has no
>ideas what the project want me to do??? There are a lot of term such as
>algorithm, recursion and a lot more terms which i have not learn before. Just

 "algorithm" is simply an exact description of how to carry out a 
 calculation step-by-step; in effect the "method" part of a computer
 program without the variable descriptions at the top.  
 "recursive" means a calculation is described in terms of [1] a simpler
 version of the same calculation and [2] knowing when it's so simple
 you have the answer trivially. For example:
 int factorial(int n){
     if(n<=1)return 1; else return factorial(n-1)*n; 
 };

 You should regard the CODE(method) of factorial as like the recipe,
 and the data of any separate execution as like the mixing bowl.  The
 same recipe can be used by different people at once, but each need
 their own mixing bowl or things get confused :->.  If you ask
 factorial(3) it will get so far and ask for...
    factorial(2) will get so fat and ask for...
        factorial(1) which is one
    times two is two
 time three is six. Done


 
>hoping that someone will explain what the project want me to do? (attach
>project.txt)
>please help me, coz i only learn the basic of C++ to array only.
>please do a word wrap as it will make reading more easier.
>
>Thank you all.
>--
>==========================
>| õ¿õ | õ¿õ | õ¿õ | õ¿õ |
>Email: cdman AT mbox2 DOT singnet DOT com DOT sg
>Eight => Galaxynet => #milkbar
>UIN: 6930385
>==========================
>
>
>PROJECT TITLE:
>==============
>Development of Software Routines to find the 4th Order Determinant.
>
>PROJECT DESCRIPTION:
>====================
>
>A 2nd order determinant,
>
>   | a11   a12 |
>   | a21   a22 |
>
>can be calculated using the formula:
>
>   | a11   a12 |
>   | a21   a22 | =  a11 * a22 - a12 * a22
>
>
>To calculate the 3rd order determinant, each element of a selected row 
>multiples 
>the minor of the element. The result are added or subtracted together in an 
>alternating pattern
>
>The minor of an element aij is determinant obtained by removing row i and 
>column 
>j.
>
>As an example, the 3rd order determinant,
>
>   | a11   a12   a13 |
>   | a21   a22   a23 |
>   | a31   a32   a33 |
>
>can be calculated as
>
>   | a11   a12   a13 |
>   | a21   a22   a23 |  
>   | a31   a32   a33 |    
>
>=  a11 * minor(a11) - a12 * minor(a12) + a13 * minor(a13)
>
>or
>
>   | a11   a12   a13 | 
>   | a21   a22   a23 | 
>   | a31   a32   a33 |
>
>=  a11 * | a22  a23 | - a12 * | a21  a23 | + a13 * | a21  a22 |
>         | a32  a33 |         | a31  a33 |         | a31  a32 |
>
>         row 1,               row 1,               row 1,
>         column 1             column 2             column 3
>         removed              removed              removed


Try something like this....... except that crap versions of C++ will
insist on you taking the function def OUTSIDE the class when it contains
for loops.

class TSquareMatrix {  public:
   int NElements;     //number of rows and columns
   double a[20][20];  //the square matrix
   //
   //consruct: set number of elements and fill them all in.
   //
   SquareMatrix(int N0=4, double X0=0.0){ NElements=N0;
      for(int i=0; i<N0; ++i) for(int j=0; j<N0; ++j) a[i][j]=X0;
   };
   //
   //make the "minor" of a determinant
   //
   static makeMinor(TSquareMatrix &Out, TSquareMatrix &Inp, int Gap){  
      int n=Inp.NElements;  Out.Nelements=n-1;
      for(int i=0; i<n; ++i){
         for(int j=0,j1=0; j<n; ++j){
            if(j!=Gap){               Out[i][j1++] = Inp[i-1][j]; };
         }; //EndFor_j
      }; // EndFor_i
   };
}

well, if you have a SquareMatrix for a determinant and another
blank SqaureMatrix, you know how to make the mninor in it now.



                                            |~/           |~/
~~|;'^';-._.-;'^';-._.-;'^';-._.-;'^';-._.-;||';-._.-;'^';||_.-;'^'0-|~~
P |      Woof Woof, Glug Glug               ||____________||      0  | P
O |   Who Drowned the Judge's Dog?          | . . . . . . . '----. 0 | O
O |         answers on                  *---|_______________  @__o0  | O
L |{a href="news:alt.religion.scientology"}{/a}_____________|/_______| L
and{a href="http://www.xemu.demon.co.uk/clam/lynx/q0.html"}{/a}XemuSP4(:)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019