//ctype.cpp
//##
#include <iostream>
using std::cout;
using std::endl;
#include <string>
using std::string;
int main(){
char holdACharacter='A'; //<-- Single quotes ' ' for characters
string holdAString="A"; //<-- double quotes " " for strings
cout<<holdACharacter<<endl;
cout<<holdAString<<endl;
}//end of main
---
./ctype
A
A
can you get it? :P
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
void convertTime(int hour, char& type)
{
int time;
if (hour < 12)
{
type = "A"; //<--- error: double quotes for char variable
}
if (hour > 12)
{
time = 12 - hour;
type = "P" ; //Same here
}
}
hi @eyenrique
thanks for replying but i cant get it. :P
cant we just do it by using just parameters and overloading?because thats the chapter i have reached so far .