Enviado em 03/11/2017 - 16:54h
queria fazer esse programa ler o arquivo e depois salvar em outro arquivo dividindo os resultados de x e y em uma matriz[i][j], o outro arquivo de leitura tem 3 variaveis o de escrita quero que ele fique somente com os as duas ultimas colunas#include <fstream>
#include <iostream>
#include <cmath>
#include <string>
#include <cstdio>
using namespace std;
int main(int argc, char *argv[]) {
double a, b, c, theta[][];
int i, j;
string data;
//Associação de abertura:
ifstream entrada("pf39_theta_830000.dat"); // construtor.
//Associação e abertura:
ofstream saida("thetaij.dat"); // construtor.
// Enquanto o final do arquivo não for atingido
while (!entrada.eof())
{
// manipulação:
entrada >> a, b, c; // leitura:
for(i=0; i<=a; i++){
for(j=0; j<=b; j++){
if(!entrada.eof()){ // não é o final de arquivo
//Exibe valores lidos
cout << a << '\t' << b << '\t' << c << endl;
// Manipulação:
saida << theta[i][j] << endl; // Escrita.
}
}
}
}
entrada.close(); // fechamento da entrada.
saida.close(); // fechamento da saída.
return 0;
}
Desktop Linux ganha fôlego enquanto distros refinam experiência e segurança
Wayland em alta, IA em debate e novos ventos para distros e devices
Qt 6.10 e Python 3.14 puxam o ritmo do software livre nesta quarta
Atualizações de Apps, Desktop e Kernel agitam o ecossistema Linux nesta terça-feira
Como mudar o nome de dispositivos Bluetooth via linha de comando
Adicionando o repositório backports no Debian 13 Trixie
Não tenho som no meu Kali linux [RESOLVIDO] (3)
Primeiras impressões do Debian 13 (28)
Erro ao enviar notificação por e-mail (1)
Erro ao fazer remaster usando Penguin eggs (2)
Meu Amigo não consegue entrar em meu mundo, via tailscale, hamachi e z... (1)