Generation

generate functionTue, 09 May 2023

pedir al usuario 2 cadenas de caracteres de numeros, uno entero y el otro real, convertirlos a sus respectivos valores y por ultimo sumarlos.

#include <iostream> using namespace std; int main() { string a, b; cout << "Ingrese el primer numero: "; getline(cin, a); cout << "Ingrese el segundo numero: "; getline(cin, b); cout << "La suma es: " << atoi(a.c_str()) + atof(b.c_str()); return 0; }

Questions about programming?Chat with your personal AI assistant