Kod: Zaznacz cały
struct notebook
{
char nazwa;
int cena;
};
Kod: Zaznacz cały
void czytaj_z_pliku(ifstream &plik, int tab[][])
{for(int i=0;i<n;i++)
{for(int j=0;j<m;j++)
plik>>tab[i][j]
}
}
Mam jeszcze jeden problem
Kod: Zaznacz cały
// basic file operations
#include <cstdio>
#include <math.h>
#include <ctime>
#include <cstdlib>
#include <stdio.h>
#include <iostream>
#include <fstream>
using namespace std;
const int n=4;
const int m=6;
void losuj(int tab [n][m]);
int main () {
srand(time(0));
int M[n][m];
int y;
ofstream plik_we;
losuj(M);
cout<<"podaj y"<<endl;
cin>>y;
plik_we.open ("example.txt");
for(int i=0;i<n;i++)
{for(int j=0;j<m;j++)
{if(M[i][j]>y)
plik_we << M[i][j]<<" ";
}
}
plik_we.close();
return 0;
}
void losuj(int tab [n][m])
{
for(int i=0;i<n;i++)
{ for(int j=0;j<m;j++)
{
tab[i][j] = rand() % (50 -(-20) +1) + (-20);
}
}
}