lunes, 12 de septiembre de 2011

Listado de números

Crear una aplicación en Visual C++ que solicite el valor inicial, el valor final y el salto, y a partir de esos valores genere el listado de números correspondiente.




- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Código Fuente
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


private: System::Void bt_numeros_Click(System::Object^  sender, System::EventArgs^  e) {

	int v_inicial=1, v_final=100, v_salto=1;
				 
	 v_inicial = Convert::ToInt32 (this->tb_valor_inicial->Text);
	 v_final = Convert::ToInt32 (this->tb_valor_final->Text);
	 v_salto = Convert::ToInt32 (this->tb_salto->Text);

	 this->tb_pares->Text = "";

	 for (int i = v_inicial; i <= v_final; i+= v_salto)
	 {
		 this->tb_numeros->Text += Convert::ToString(i);
		 this->tb_numeros->Text += "\r\n";
	 }

}
}

No hay comentarios:

Publicar un comentario

Related Posts Plugin for WordPress, Blogger...