• Matéria: Informática
  • Autor: caioneves5693
  • Perguntado 3 anos atrás

Me ajudem na resolução desse código:


// Complete this function to return either

// "Hello, [name]!" or "Hello there!"

// based on the input

std::string say_hello(std::string name) {

// You can print to STDOUT for debugging like you normally would:

std::cout << name << std::endl;


// but you need to return the value in order to complete the challenge

return name; // TODO: return the correct value

Respostas

respondido por: joaopedrolemos
2

#include <iostream>

#include <string>

using namespace std;

string say_hello(string name){

   string rec = "Hello, ";

   return rec+name;

}

int main(){

   string name1;

   cout << "::"; cin >> name1;

   cout << say_hello(name1);

   return 0;

}

Perguntas similares