return function in cpp
void printChars(char c, int count) {
for (int i=0; i<count; i++) {
cout << c;
}//end for
return; // Optional because it's a void function
}//end printChars
return function in cpp
void printChars(char c, int count) {
for (int i=0; i<count; i++) {
cout << c;
}//end for
return; // Optional because it's a void function
}//end printChars
function return with int c++
#include <iostream>
int getValueFromUser()
{
std::cout << "Enter an integer: ";
int input{};
std::cin >> input;
return input;
}
int main()
{
int x{ getValueFromUser() }; // first call to getValueFromUser
int y{ getValueFromUser() }; // second call to getValueFromUser
std::cout << x << " + " << y << " = " << x + y << 'n';
return 0;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us