3 FunctionsC++
3 FunctionsC++
int main() {
repchar('-', 43); //call to function
cout << "Data typ Range" << endl;
repchar('=', 23);
cout << "char -128 to 127" << endl;
cout << "short -32,768 to 32,767" << endl;
cout << "int System dependent" << endl;
cout << "double -2,147,483,648 to 2,147,483,647" << endl;
repchar('-', 43);
char chin; int nin;
cout << "Enter a character: ";
cin >> chin;
cout << "Enter number of times to repeat it: ";
void repchar(char ch, int n) {
cin >> nin;
for(int j=0; j<n; j++)
repchar(chin, nin);
cout << ch;
return 0;
cout << endl;
}
}
3
12
13
14
int main() {
float lbs;
cout << “\nEnter your weight in pounds: “;
cin >> lbs;
cout << “Your weight in kilograms is “ << lbstokg(lbs) << endl;
return 0;
}
15
16
17