main.cpp.txt

(2 KB) Pobierz
/*#include "stdafx.h"
#include <malloc.h>

typedef unsigned char byte;

struct Image
{
	int w,k;
	byte** obraz; 
};

struct Image CreateImage(int wiersze, int kolumny)
{
	Image obrazek;

	obrazek.w=wiersze;
	obrazek.k=kolumny;
	/*obrazek.obraz=malloc(wiersze*sizeof(byte*) );
	for(int i=0; i<wiersze; i++){
		obrazek.obraz[i]=malloc(kolumny*sizeof(byte);
	}
	return obrazek;
}

int main()
{
	return 0;
}*/
//////////////////////////////////////////////////////////////////////////////

#include <cstdlib>
#include <iostream>
#include "image.hpp"

using namespace std;

int main(int argc, char *argv[])
{
      int a;
      
      image mojobraz = CreateImage();   
    
      DisplayImage (&mojobraz);              //&adres - f. odwrotna do wyluskania

    do{
        cout<<"Co chcesz zrobic?"<<endl;
        cout<<" 1 - nadac te sama jasnosc wszystkim pikselom"<<endl; 
        cout<<" 2 - odczytac wybrany piksel"<<endl;
        cout<<" 3 - zmienic wartosc wybranego piksela"<<endl;
        cout<<" 4 - odczytac wysokosc i szerokosc obrazu"<<endl;
        cout<<" 5 - wyswietlic wartosci calego obrazu"<<endl; 
        cout<<" 6 - czyszczenie konsoli"<<endl;   
        cout<<" 0 - wyjscie z programu                 wybor:  "<<endl;

        cin>>a;
        
        switch(a){
                case 0:{
                     DeleteImage (mojobraz);
                     return EXIT_SUCCESS;}
                break; 
                case 1:{
                       fillInImage (&mojobraz);            
                       break;
                    }     
                case 2:{
                       ReadPixel (&mojobraz); 
                       break;
                     }     
                case 3:{
                       WritePixel (&mojobraz); 
                       break;
                      }     
                case 4:{
                       SizeImage (&mojobraz); 
                       break;
                     }
                case 5:{
                       DisplayImage (&mojobraz);  
                       break;
                     }
                case 6:{
                       system("CLS");  
                       break;
                     }     
                default:
                    cout<<"bledny wybor"<<endl;         
        }
    }while(1);
    
    DeleteImage (mojobraz);
    system("PAUSE");
    return EXIT_SUCCESS;
}
Zgłoś jeśli naruszono regulamin