Advertisement
Guest User

Untitled

a guest
May 2nd, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. #include <iostream>
  2. #include "Wektor.hh"
  3. #include "Macierz.hh"
  4. #include "UkladRownanLiniowych.hh"
  5. #include "LZespolona.hh"
  6. #include <unistd.h>
  7. #include <stdlib.h>
  8.  
  9. using namespace std;
  10.  
  11. /*!
  12. * \file
  13. * \brief funkcja glowna main
  14. *
  15. * Funkcja glowna odpowiada za wczytanie funkcji, liczeniu ukladu rownan oraz wypisaniu odpowiedzi.
  16. */
  17. int main(int argc, char** argv)
  18. {
  19.  
  20. int c, wielkosc;
  21. UkladRownanLiniowych<Typ,Rozmiar> U;
  22. while((c=getopt(argc,argv, "n:"))!=-1)
  23.  
  24. {
  25.  
  26. switch(c)
  27. {
  28. case 'n':
  29. wielkosc=atoi(optarg);
  30. U.SaveRozmiar(wielkosc);
  31. U.ZapiszRozmiarDoUkladu();
  32. break;
  33. default:
  34. if(argc=='n'){
  35.  
  36. cerr<<"zle polecenie"<<endl;
  37. cerr<<"poprawna instrukcja ./a.out -n 3/4"<<endl;
  38. assert(0);
  39. }
  40. else if (wielkosc==33188)
  41. {
  42. cerr<<"nie podano wielkosci macierzy"<<endl;
  43. assert(0);
  44. }
  45. else if (wielkosc!=3 && wielkosc!=4)
  46. {
  47. cerr<<"niepoprawna wielkosc macierzy"<<endl;
  48. cerr<<"poprawna wielkosc macierzy to 3 lub 4"<<endl;
  49. assert(0);
  50. }
  51.  
  52. else
  53. {
  54. cerr<<"nie podano wielkosci macierzy"<<endl;
  55. assert(0);
  56. }
  57. break;
  58. }
  59. cout<<"a.out to nazwa pliku uklad_rownan.exe"<<endl;
  60. cout<<"Rozmiar macierzy :"<<wielkosc<<endl;
  61. cout<<"Wprowadz macierz wspolczynnikow:"<<endl;
  62. cin>>U;
  63. U.LiczUklad();
  64. cout<<U<<endl;
  65.  
  66. }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement