#Include #Include: Double While
#Include #Include: Double While
#include <limits>
int main()
{
std::cout<<"This program is designed to test two linear equations. \n";
std::cout<<"In order to best solve the system, \n";
std::cout<<"equations will be in the form of a*x + b*y = c. \n";
std::cout<<"and d*x + e*y =f. \n";
std::cout<<"Please enter an integer for a, b, and c. \n";
double a, b, c, d, e, f;
while ((std::cout << "Enter a.")
&& !(std::cin >> a))
{
std::cout << "That's not a number ";
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
}
while ((std::cout << "Enter b.")
&& !(std::cin >> b))
{
std::cout << "That's not a number ";
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
}
while ((std::cout << "Enter c.")
&& !(std::cin >> c))
{
std::cout << "That's not a number ";
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
}
std::cout<<"Equation 1 is "<<a<<"x +"<<b<<"y ="<<c;
std::cout<<"Please enter an integer for d, e, and f. \n";
while ((std::cout << "Enter d.")
#include<stdio.h>
int main(){
int a[3][3],i,j;
int determinant=0;
printf("Enter the 9 elements of matrix: ");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
printf("\nThe First matrix is\n");
for(i=0;i<3;i++){
printf("\n");
for(j=0;j<3;j++)
printf("%d\t",a[i][j]);
}
for(i=0;i<3;i++)
determinant = determinant + (a[0][i]*(a[1]
[(i+1)%3]*a[2][(i+2)%3] - a[1][(i+2)%3]*a[2]
[(i+1)%3]));
printf("\nDeterminant of matrix is:
%d",determinant);
return 0;
}
return 0;
8
9
#include<stdio.h>
int main(){
int a[3][3],i,j;
long determinant;
return 0;
Sample output:
Enter the 9 elements of matrix: 1
2
3
4
5
6
7
8
9
The matrix is
1
4
7
2
5
8
3
6
9