blastermak

Algo3_v0.1

May 14th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. class koers {
  8.     public:
  9.     koers();
  10.     void berekenkoers(int dag, int aandeel);
  11.     void maxbedrag();
  12.     void leesbestand();
  13.     void matrix();
  14.    
  15.    
  16.     ifstream invoer;
  17.     string invoernaam;
  18.     int n, doeldag;         //int voor n en Tw
  19.     float bnul;         //float voor B0
  20.     int aandelen;
  21.     float koersmatrix[100][100];    //matrix voor koersen van de dagen [dag][koers[
  22.     float rente[100];       //array voor het opslaan van de rentes [dag]
  23.    
  24. }; //class koers
  25.  
  26.  
  27. koers::koers(){
  28.     invoernaam = "";
  29.    
  30.    
  31. }//koers::koers
  32.  
  33. void koers::berekenkoers(int dag, int aandeel){
  34.    
  35.    
  36.    
  37. }//void berekenkoers
  38.  
  39. void koers::maxbedrag(){
  40.    
  41.    
  42.    
  43. }//void maxbedrag
  44.  
  45. void koers::matrix(){
  46.     for(int i = 0;i< (doeldag + 1); i++){
  47.         for(int j=0;j<n;j++){
  48.             cout << koersmatrix[i][j] << " ";
  49.         }
  50.         cout << endl;
  51.     }
  52.     for(int i = 0;i< (doeldag); i++){
  53.         cout << rente[i] << endl;
  54.     }
  55.    
  56. }
  57.    
  58.  
  59.  
  60. void koers::leesbestand(){
  61.     cout << "Welk bestand wil je openen?" << endl;
  62.     cin >> invoernaam;
  63.     invoer.open(invoernaam.c_str(), ios::in);
  64.         if( !invoer ){
  65.             cout << "Bestand bestaat niet";
  66.             return;
  67.         }//if
  68.     invoer >> doeldag; 
  69.     invoer >> n;
  70.     invoer >> bnul;
  71.     for(int i = 0; i < (doeldag + 1); i++){
  72.         for(int j = 0; j < n; j++){
  73.             invoer >> koersmatrix[i][j];
  74.         }
  75.     }
  76.     for(int i = 0; i < (doeldag ); i++){
  77.         invoer >> rente[i];
  78.     }//for
  79. }//void leesbestand
  80.  
  81. int main (){
  82.     koers start;
  83.     start.leesbestand();
  84.     cout << start.n << " " << start.doeldag << " " << start.bnul << endl;
  85.     start.matrix();
  86.  
  87.  
  88. }//main
Advertisement
Add Comment
Please, Sign In to add comment