Hi, I have the ffg code, where I hope to muliply the 3 arrays specified, but on running Printarray(), i'm not getting what I expect. Help please!
Code:
// Q2_new.cpp : Defines the entry point for the console application.
//
#include <math>
#include "stdafx.h"
#include <iostream>
using namespace std;
double theta, phi, t, p; //azimuth and dip angles respectively
double lambda1 = 0.5;
double lambda2 = 2;
const double pi = 3.142857;
const int rows = 3;
const int cols = 3;
//---------------------------------------------------------
//Code to convert the angles to radians, acceptable in C++
//---------------------------------------------------------
double rad_t(double t)
{
theta = (t*pi)/180;
return theta;
}
double rad_p(double p)
{
phi= (p*pi)/180;
return phi;
}
//-----------------------------------------------------------
//Initializing the matrices
//-----------------------------------------------------------
//array that holds the dip angle, phi
double dip_array [3][3] = {{cos(phi),0,-sin(phi)},{0,1,0},{sin(phi),0,cos(phi)}};
//array that holds the azimuth angle, theta
double azim_array [3][3] = {{sin(theta),cos(theta),0},{-cos(theta),sin(theta),0},{0,0,1}};
//array that holds the anisotropy ratios
double lambda_array [3][3] = {{lambda1,0,0},{0,1,0},{0,0,lambda2}};
//----------------------------------------------------------------
void printarray (double arg[][3])
{
for (int n=0; n<3; n++)
cout << arg[n] << " ";
cout << "\n";
}
int main(int argc, char* argv[])
{
cout<<"ANISOTROPY MODELLING.\n";
cout<<"Please enter a real number between 0 and 360 for the azimuth angle, theta, then press the 'Enter' key.\n";
cin>>t;
rad_t(t);'\n\n.';
cout<<"Please enter a real number between 0 and 360 for the dip angle, phi, then press the 'Enter' key.\n";
cin>>p;
rad_p(p);
printarray(dip_array);
printarray(azim_array);
printarray(lambda_array);
return 0;
}