View Full Version : các sư huynh gợi ý hộ e bài này với
songlunglinh_nhok
19-08-2012, 02:57 PM
nhập vào ngày tháng năm như sau:
day: 02
month: 10
year: 90
hiện ra màn hinh: thang muoi/02/1990
các sư huynh hướng dẫn e làm bài này với thanks trước các sư huynh!
achoo254
03-09-2012, 11:03 AM
Bạn không nói code bằng ngôn ngữ gì thì ai biết đường mà chỉ??
mrcanhao
04-09-2012, 03:16 PM
bạn muốn viết bằng ngôn ngữ lập trình j...
hay viết bằng tiếng việt hê hê....\m/
songlunglinh_nhok
04-09-2012, 03:57 PM
sorry nha các sư huynh viết bằng C++ ak!
mrcanhao
04-09-2012, 04:19 PM
dùng cin+cout để xuất ra thôi
dễ mà bạn... giống printf-scanf thôi mà
songlunglinh_nhok
05-09-2012, 02:56 PM
các sư huynh kiểm tra lỗi hộ e nha!
#include<conio.h>
#include<iostream.h>
int main()
{
int day,month,year;
cout<<"Nhap day: ";cin>>day;
cout<<"Nhap month: ";cin>>month;
cout<<"Nhap year: ";cin>>year;
switch(month)
{
case 1: cout<<"Thang mot"<<"/";
break;
case 2: cout<<"Thang hai"<<"/";
break;
case 3: cout<<"Thang ba"<<"/";
break;
case 4: cout<<"Thang tu"<<"/";
break;
case 5: cout<<"Thang nam"<<"/";
break;
case 6: cout<<"Thang sau"<<"/";
break;
case 7: cout<<"Thang bay"<<"/";
break;
case 8: cout<<"Thang tam"<<"/";
break;
case 9: cout<<"Thang chin"<<"/";
break;
case 10: cout<<"Thang muoi"<<"/";
break;
case 11: cout<<"Thang muoi mot"<<"/";
break;
case 12: cout<<"Thang muoi hai"<<"/";
break;
}
switch(year)
{
case 00: cout<<day<<"/"<<1900;
break;
case 01: cout<<day<<"/"<<1901;
break;
case 02: cout<<day<<"/"<<1902;
break;
case 03: cout<<day<<"/"<<1903;
break;
case 04: cout<<day<<"/"<<1904;
break;
case 05: cout<<day<<"/"<<1905;
break;
case 06: cout<<day<<"/"<<1906;
break;
case 07: cout<<day<<"/"<<1907;
break;
case 08: cout<<day<<"/"<<1908;
break;
case 09: cout<<day<<"/"<<1909;
break;
case 10: cout<<day<<"/"<<1910;
break;
case 11: cout<<day<<"/"<<1911;
break;
case 12: cout<<day<<"/"<<1912;
break;
case 13: cout<<day<<"/"<<1913;
break;
case 14: cout<<day<<"/"<<1914;
break;
case 15: cout<<day<<"/"<<1915;
break;
case 16: cout<<day<<"/"<<1916;
break;
case 17: cout<<day<<"/"<<1917;
break;
case 18: cout<<day<<"/"<<1918;
break;
case 19: cout<<day<<"/"<<1919;
break;
case 20: cout<<day<<"/"<<1920;
break;
case 21: cout<<day<<"/"<<1921;
break;
case 22: cout<<day<<"/"<<1922;
break;
case 23: cout<<day<<"/"<<1923;
break;
case 24: cout<<day<<"/"<<1924;
break;
case 25: cout<<day<<"/"<<1925;
break;
case 26: cout<<day<<"/"<<1926;
break;
case 27: cout<<day<<"/"<<1927;
break;
case 28: cout<<day<<"/"<<1928;
break;
case 29: cout<<day<<"/"<<1929;
break;
case 30: cout<<day<<"/"<<1930;
break;
case 31: cout<<day<<"/"<<1931;
break;
case 32: cout<<day<<"/"<<1932;
break;
case 33: cout<<day<<"/"<<1933;
break;
case 34: cout<<day<<"/"<<1934;
break;
case 35: cout<<day<<"/"<<1935;
break;
case 36: cout<<day<<"/"<<1936;
break;
case 37: cout<<day<<"/"<<1937;
break;
case 38: cout<<day<<"/"<<1938;
break;
case 39: cout<<day<<"/"<<1939;
break;
case 40: cout<<day<<"/"<<1940;
break;
case 41: cout<<day<<"/"<<1941;
break;
case 42: cout<<day<<"/"<<1942;
break;
case 43: cout<<day<<"/"<<1943;
break;
case 44: cout<<day<<"/"<<1944;
break;
case 45: cout<<day<<"/"<<1945;
break;
case 46: cout<<day<<"/"<<1946;
break;
case 47: cout<<day<<"/"<<1947;
break;
case 48: cout<<day<<"/"<<1948;
break;
case 49: cout<<day<<"/"<<1949;
break;
case 50: cout<<day<<"/"<<1950;
break;
case 51: cout<<day<<"/"<<1951;
break;
case 52: cout<<day<<"/"<<1952;
break;
case 53: cout<<day<<"/"<<1953;
break;
case 54: cout<<day<<"/"<<1954;
break;
case 55: cout<<day<<"/"<<1955;
break;
case 56: cout<<day<<"/"<<1956;
break;
case 57: cout<<day<<"/"<<1957;
break;
case 58: cout<<day<<"/"<<1958;
break;
case 59: cout<<day<<"/"<<1959;
break;
case 60: cout<<day<<"/"<<1960;
break;
case 61: cout<<day<<"/"<<1961;
break;
case 62: cout<<day<<"/"<<1962;
break;
case 63: cout<<day<<"/"<<1963;
break;
case 64: cout<<day<<"/"<<1964;
break;
case 65: cout<<day<<"/"<<1965;
break;
case 66: cout<<day<<"/"<<1966;
break;
case 67: cout<<day<<"/"<<1967;
break;
case 68: cout<<day<<"/"<<1968;
break;
case 69: cout<<day<<"/"<<1969;
break;
case 70: cout<<day<<"/"<<1970;
break;
case 71: cout<<day<<"/"<<1971;
break;
case 72: cout<<day<<"/"<<1972;
break;
case 73: cout<<day<<"/"<<1973;
break;
case 74: cout<<day<<"/"<<1974;
break;
case 75: cout<<day<<"/"<<1975;
break;
case 76: cout<<day<<"/"<<1976;
break;
case 77: cout<<day<<"/"<<1977;
break;
case 78: cout<<day<<"/"<<1978;
break;
case 79: cout<<day<<"/"<<1979;
break;
case 80: cout<<day<<"/"<<1980;
break;
case 81: cout<<day<<"/"<<1981;
break;
case 82: cout<<day<<"/"<<1982;
break;
case 83: cout<<day<<"/"<<1983;
break;
case 84: cout<<day<<"/"<<1984;
break;
case 85: cout<<day<<"/"<<1985;
break;
case 86: cout<<day<<"/"<<1986;
break;
case 87: cout<<day<<"/"<<1987;
break;
case 88: cout<<day<<"/"<<1988;
break;
case 89: cout<<day<<"/"<<1989;
break;
case 90: cout<<day<<"/"<<1990;
break;
case 91: cout<<day<<"/"<<1991;
break;
case 92: cout<<day<<"/"<<1992;
break;
case 93: cout<<day<<"/"<<1993;
break;
case 94: cout<<day<<"/"<<1994;
break;
case 95: cout<<day<<"/"<<1995;
break;
case 96: cout<<day<<"/"<<1996;
break;
case 97: cout<<day<<"/"<<1997;
break;
case 98: cout<<day<<"/"<<1998;
break;
case 99: cout<<day<<"/"<<1999;
break;
}
getch();
return 0;
}
songlunglinh_nhok
05-09-2012, 03:00 PM
nếu bỏ đi dòng 55,56,57,58 thì nó chạy bình thường còn ngược lại thì nó báo lỗi các sư huynh góp ý hộ!
phongvelacviet.com
05-09-2012, 04:30 PM
cái này sao giống c++ vậy? hihiiiiiiiiiiiiiiiiiiiiiiiii
251PV_iphonepro
05-09-2012, 07:57 PM
Xin cảm ơn nhiều.
Đang cần tìm thông tin này.
songlunglinh_nhok
06-09-2012, 12:21 PM
trời ạ C++ chứ gì nữa sữa lỗi hộ e đi mấy sư huynh >_<
Phúc Cùi Bắp
07-09-2012, 08:24 PM
Làm gì mà phải làm cái hàm switch dài dữ vậy chứ
#include<conio.h>
#include<iostream.h>
int main()
{
int day,month,year;
cout<<"Nhap day: ";cin>>day;
cout<<"Nhap month: ";cin>>month;
cout<<"Nhap year: ";cin>>year;
switch(month)
{
case 1: cout<<"Thang mot"<<"/";
break;
case 2: cout<<"Thang hai"<<"/";
break;
case 3: cout<<"Thang ba"<<"/";
break;
case 4: cout<<"Thang tu"<<"/";
break;
case 5: cout<<"Thang nam"<<"/";
break;
case 6: cout<<"Thang sau"<<"/";
break;
case 7: cout<<"Thang bay"<<"/";
break;
case 8: cout<<"Thang tam"<<"/";
break;
case 9: cout<<"Thang chin"<<"/";
break;
case 10: cout<<"Thang muoi"<<"/";
break;
case 11: cout<<"Thang muoi mot"<<"/";
break;
case 12: cout<<"Thang muoi hai"<<"/";
break;
}
cout<<day<<"/19"<<year;
getch();
return 0;
}
nanqua
08-10-2012, 11:02 AM
trời ơi mới học buổi đầu về xem cái này mà hoa cả mắt
nomoreever79
20-03-2013, 07:16 PM
Đây là cách của mình, hi:
#include <iostream>
#include <string>
using namespace std;
void main()
{int day,month,year;
string readmonth;
cout<<"Nhap ngay ";
cin>>day;
cout<<endl;
cout<<"Nhap thang ";
cin>>month;
cout<<endl;
cout<<"Nhap nam ";
cin>>year;
cout<<endl;
// readmonth de doc thang
if (month==1)
{readmonth="Thang mot";}
else if (month==2)
{readmonth="Thang hai";}
else if (month==3)
{readmonth="Thang ba";}
else if (month==4)
{readmonth="Thang tu";}
else if (month==5)
{readmonth="Thang nam";}
else if (month==6)
{readmonth="Thang sau";}
else if (month==7)
{readmonth="Thang bay";}
else if (month==8)
{readmonth="Thang tam";}
else if (month==9)
{readmonth="Thang chin";}
else if (month==10)
{readmonth="Thang muoi";}
else if (month==11)
{readmonth="Thang muoi mot";}
else if (month==12)
{readmonth="Thang muoi hai";}
cout<<readmonth<<"/"<<day<<"/"<<year<<endl;
system("pause");
};
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.