Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int a[20][20],n;
- void citire()
- {
- int i,j;
- fstream f("atestat.in.in",ios::in);
- f>>n;
- for(i=1;i<=n;i++)
- for(j=1;j<=n;j++)
- f>>a[i][j];
- f.close();
- }
- void afisare_a()
- {
- int i,j;
- for(i=1;i<=n;i++)
- {
- for(j=1;j<=n;j++)
- cout<<a[i][j]<<" ";
- cout<<endl;
- }
- }
- void afisare_b()
- {
- int i,j,k,gasit=0;
- cout<<"valoare cautata este";
- cin>>k;
- for(i=1;i<=n&&gasit==0;i++)
- for(j=1;j<=n&&gasit==0;j++)
- if(a[i][j]==k)
- gasit=1;
- if(gasit==1)
- cout<<"valoreeeeeeeeeee"<<k<<"se afla in matrice";
- else
- cout<<"VALOAREEEEEEEEEEEEE"<<k<<"nu se afla in matrie";
- }
- void afisare_c()
- {
- int i,j;
- fstream g("atestat.in.out",ios::out);
- for(j=1;j<=n;j++)
- a[n][j]=0;
- for(i=1;i<=n;i++)
- {
- for(j=1;j<=n;j++)
- g<<a[i][j]<<" ";
- g<<endl;
- }
- g.close();
- }
- int main()
- {
- citire();
- afisare_a();
- afisare_b();
- afisare_c();
- return 0;
- }
- 13
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement