242,166 views
15 votes
15 votes
(C++)Define a function PrintStateCode() that takes two string parameters and outputs as follows, ending with a newline. The function should not return any value.

Ex: If the input is CT Connecticut, then the output is:

CT is Connecticut's state code.

User Eric Kamara
by
3.2k points

1 Answer

18 votes
18 votes

#include <iostream>

#include <cstring>

void PrintStateCode(std::string f, std::string s) {

std::cout << f << " is " << s << "'s state code.\\";

}

int main(int argc, char* argv[]) {

std::string _f, _s; std::cin>>_f>>_s;

PrintStateCode(_f,_s);

return 0;

}

(C++)Define a function PrintStateCode() that takes two string parameters and outputs-example-1
User Adrian Leonhard
by
2.8k points