Mssv:2011 1338
DDT04-K56
Page 1
system("pause");
}
// 4_lichnam.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int ngay,thang,years,dy,i;
cout<<"
Nhap nam: ";cin>>years;
dy=years-2000;
i=(365*dy+(dy-1)/4)%7;
for(thang=1;thang<=12;thang++)
{switch(thang)
{
case 2: (dy%4)==0?(ngay=29):(ngay=28);break;
case 4: case 6: case 9:case 11: ngay=30;break;
default: ngay =31;
}
cout<<"*---------------------===-----------------------*";
cout<<"\n
Thang "<<thang;cout<<"\n";
cout<<"\nCN\tT2\tT3\tT4\tT5\tT6\tT7\n";
for(int k=1;k<=i;k++) cout<<'\t';
for(int j=1;j<=ngay;j++)
{
cout<<j;
if(i==6)
Page 2
{cout<<'\n';i=0;}
else
{cout<<'\t';i++;}
}
cout<<"\n";
}
system("pause");
}
// 5_mangchanle8.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<iostream>
#include<math.h>
using namespace std;
Page 3
cout<<a;
cout<<'\n';
system("pause");
}
// 8_xaukituchuthuong.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<iostream>
#include<string.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
char s[50];int i;
cout<<"Nhap xau ki tu:";cin>>s;
for(i=0;s[i]!=0;i++)
{
if(s[i]>=65 && s[i]<=90)
s[i]=s[i]+32;
}
cout<<'\n';
cout<<s;cout<<'\n';
system("pause");
}
// 9_hamgiaiptbac2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<iostream>
using namespace std;
int findroot(double a,double b, double c)
{
double d=b*b-4*a*c;
double *x1,*x2;
if (d<0) return 0;
a*=2;
if(d=0) {*x1=*x2=-b/a;return 1;}
d=sqrt(d);
*x1=(-b-d)/a;
*x2=(-b+d)/a;
return 2;
}
int main()
{
double a,b,c;
while(1){
cout<<"Nhap cac he so a, b, c:";
cin>>a>>b>>c;
if(a==0) break;
// neu a=0 thi thoat
double *x1, *x2;
switch( findroot(a,b,c))
{
Page 4
Page 5