here is my code
Code:
#include <iostream>
#include <stdlib.h>
using namespace std; // using standard namespace
int main ()
{
char date[10], fname[20], lname[20];
int d1, d2, m1, m2, y1, y2, y3, y4, year, day, month, ex1t;
cout <<"enter 0 instead of your first name to exit"<<endl<<endl ;
for (int x=1; x>0; x++)
{
cout <<"enter you first name: " ;
cin >>fname ;
ex1t=atoi(fname[0]);
if (ex1t==0)
exit(0);
cout <<"enter your last name: " ;
cin >>lname ;
cout << "enter your birthdate in the format mm/dd/yyyy: " ;
cin >>date ;
d1=atoi(date[3]);
d2=atoi(date[4]);
m1=atoi(date[0]);
m2=atoi(date[1]);
y1=atoi(date[6]);
y2=atoi(date[7]);
y3=atoi(date[8]);
y4=atoi(date[9]);
year=(y1*1000)+(y2*100)+(y3*10)+(y4);
month=(m1*10)+(m2);
day=(d1*10)+(d2);
if ((month<12||month>1))
if (month==(1||3||5||7||8||10||12)&&(day<32))
cout <<lname <<", "<<fname <<", " <<date <<". "<< endl<<endl;
if (month==(4||6||9||11)&&(day<31))
cout <<lname <<", "<<fname <<", " <<date <<". "<< endl<<endl;
}
return 0;
}
and here are the errors
Code:
--------------------Configuration: program4 - Win32 Debug--------------------
Compiling...
program4.cpp
H:\program4.cpp(22) : error C2664: 'atoi' : cannot convert parameter 1 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
H:\program4.cpp(29) : error C2664: 'atoi' : cannot convert parameter 1 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
H:\program4.cpp(30) : error C2664: 'atoi' : cannot convert parameter 1 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
H:\program4.cpp(31) : error C2664: 'atoi' : cannot convert parameter 1 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
H:\program4.cpp(32) : error C2664: 'atoi' : cannot convert parameter 1 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
H:\program4.cpp(33) : error C2664: 'atoi' : cannot convert parameter 1 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
H:\program4.cpp(34) : error C2664: 'atoi' : cannot convert parameter 1 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
H:\program4.cpp(35) : error C2664: 'atoi' : cannot convert parameter 1 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
H:\program4.cpp(36) : error C2664: 'atoi' : cannot convert parameter 1 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
program4.exe - 9 error(s), 0 warning(s)
what is im doing wrong?