gdzie jest błąd?
pozdrawiam!
Kod: Zaznacz cały
#include <stdio.h>
//#include <cstdlib.h> //library for cleaning the screen
int owned_matrices[27];
char choose_opt()
{
char temp_opt;
system("cls");
printf("Matrix calculator
(a) Create new matrix
(b) Edit existing matrix
(c) Show existing matrix
(d) Delete existing matrix
(e) Save matrices to the file
(f) Load matrices from the file
(g) Transposition (MxN)^T = (NxM)
(h) Addition (MxN)+(MxN)=(MxN)
(i) Scalar multiplication c*(MxN)=(MxN)
(j) Matrix multiplication (MxN)x(NxP)=(MxP)
(k) Exponentiation (MxM)^c=(MxM)
(l) Determinant det[(MxM)]=c
(m) Inverse (MxM)^(-1)=(MxM) if det[(MxM)]<>0
(n) About the program
(o) Exit the application\n");
do
{
printf("Choose your option.");
temp_opt = getch();
if ((temp_opt < 'a')||(temp_opt > 'o'))
printf("\nImproper choice. ");
else
printf("\n");
} while ((temp_opt < 'a')||(temp_opt > 'o'));
return temp_opt;
}
void Show_owned()
{
int i;
int do_you_own_any_matrix=0; //check wheter there are any owned matrices
for (i=1;i<=26;i++)
{
if (owned_matrices[i]==1)
{
do_you_own_any_matrix=1;
break;
}
}
if (do_you_own_any_matrix = 1) //if there are, show which one
{
printf("You own these matrices: ");
for (i=1;i<=26;i++)
{
if (owned_matrices[i]==1)
printf("%c",'a'+i-1);
}
}
else
printf("You do not own any matrix.");
}
void Func_a()
{
Show_owned();
}
int main(int argc, char *argv[])
{
char chosen_opt;
int i; //give the information that there are no owned matrices
for (i=1;i<=26;i++)
owned_matrices[i]=0;
do //choose the operation on matrix
{
chosen_opt = choose_opt();
printf("Your choice: %c\n",chosen_opt);
switch (chosen_opt)
{
case 'a': Func_a(); break;
case 'o': printf("See you later!"); break;
default : printf("Under construction"); break;
}
printf("\n");
getch();
} while (chosen_opt!='o');
return 0;
}