“Leer variable a archivo cpp” Código de respuesta

Leer variable a archivo cpp

int main()
{
  	// writing process
    char name[20], phone[20];

    cout<< "Enter your name: ";
    cin>> name;
    cout<< "Enter you phone number: ";
    cin>> phone;

    ofstream file_w ("test.txt");

    file_w << name <<endl
           << phone<<endl;

    cout << "Process complete";
    file_w.close();
	
  	// reading the vairable's values
    ifstream file_r ("test.txt");

    char Name[20], Phone[20];

    file_r >> Name >> Phone;

    cout<< "Name = " << Name << endl << "Phone = " << Phone ;

    return 0;
}
Sleep deprived

Escribir variable a FILE CPP

int main()
{
    char name[20], phone[20];

    cout<< "Enter your name: ";
    cin>> name;
    cout<< "Enter you phone number: ";
    cin>> phone;

    ofstream file_w ("test.txt");

    file_w << name <<endl
           << phone<<endl;

    cout << "Process complete";
    file_w.close();
  
    return 0;
}
Sleep deprived

Respuestas similares a “Leer variable a archivo cpp”

Preguntas similares a “Leer variable a archivo cpp”

Más respuestas relacionadas con “Leer variable a archivo cpp” en C++

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código