Advertisement
Guest User

codigo

a guest
Jul 31st, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1.     ofstream fout;
  2.    
  3.     fout.open("carro.txt", ios_base::out |ios_base::binary);// out escrever arquivo/ binary arquivo tipo binario
  4.                                        
  5.     if (!fout.is_open()){
  6.  
  7.         cout << "Nao foi possivel abrir o arquivo";
  8.         exit(0);
  9.     }
  10.  
  11.     char cor[10], modelo[10];
  12.     cout << "Digite o nome\n";
  13.     cin >> modelo;
  14.     cout << "Digite a cor\n";
  15.     cin >> cor;
  16.     int t;
  17.     cout << "digite um numero\n";
  18.     cin >> t;
  19.  
  20.     fout << "Nome dele: " << modelo << endl;
  21.     fout << "Cor dele: " << cor << endl;
  22.     fout << "Numero: " << t << endl;
  23.  
  24.     fout.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement