12345678910111213141516171819202122
void notas::borrar(){ int num,num2; fstream fp,fp2; notas nota; cout << "Sucursal";cin >> num;cout << "Numero de nota: ";cin >> num2; fp.open("notas.dat",ios::in|ios::out); fp2.open("temp.dat",ios::out); fp.seekg(0,ios::beg); while(fp.read((char*)¬a,sizeof(notas))){ if((nota.retnumnota()==num2) && (nota.retsucursal()==num)){ cout << nota.retsucursal() <<" " <<nota.retnumnota() <<" " <<num <<" " << num2; system("pause"); fp2.write((char*)¬a,sizeof(notas)); } } fp.close(); fp2.close(); remove("notas.dat"); rename("temp.dat","notas.dat"); cout<<endl <<"Nota borrada." <<endl; system("pause"); }
if ( R2D2 && C3PO ) { These are the droids that we are looking for. } else { Move along! }
! ( Foo && Bar )
12
if (condition) do something
if (!condition) do something