srcteamcoder@googlegroups.com

0 views
Skip to first unread message

Fire Wall

unread,
Nov 11, 2011, 9:41:53 AM11/11/11
to srctea...@googlegroups.com, srctea...@googlegroups.com

 #include<iostream.h>

int main()
{       
        int a,b,c;
          cout<<"nhap do dai canh 1 : \n";
          cin>>a;
          cout<<"nhap do dai canh 2 : \n";
          cin>>b;
          cout<<"nhap do dai canh 3 : \n";
          cin>>c;
          if (a+b>c&&b+c>a&&a+c>b) cout<<"\n la 3 canh cua mot tam giac";
          else cout<<"\n khong la 3 canh cua mot tam giac";
        system("pause");
        return 0;
}


ngoc luong nguyen

unread,
Nov 12, 2011, 11:41:21 PM11/12/11
to srctea...@googlegroups.com


bai tap

tam giac.cpp

ngoc luong nguyen

unread,
Nov 12, 2011, 11:45:27 PM11/12/11
to srctea...@googlegroups.com
bai tap




tam giac.cpp

nguyen tho

unread,
Nov 23, 2011, 10:19:43 AM11/23/11
to srctea...@googlegroups.com
xem ho e bai nay co van de gi voi!
121.cpp

dong nguyen

unread,
Nov 23, 2011, 10:28:14 PM11/23/11
to SRC Lập trình C/C++

tớ chỉ làm sơ qua thôi cậu chỉnh lại nha

#include<iostream.h>

int nguyento(int i){

if(i==0||i==1||i==4||i==6||i==8||i==9) return 1;
return 0;


}
int kt2(int n){
int s=0,m=n,i;
while(n!=0){i=n%10;
if(nguyento(i)!=0) s++;
n=n/10;}


if(s==2) cout<<m<<endl;
return n;
}
int kt3(int n){
int s=0,m=n,i;
while(n!=0){
i=n%10;if(nguyento(i)!=0) s++;
n=n/10;}

if(s==3) cout<<m<<endl;
return n;
}

main(){int n;
for(n=10;n<100;n++){
kt2(n);
}
for (n=100;n<1000;n++){
kt3(n);}


system("pause") ;


}

Trung Hoàng

unread,
Nov 24, 2011, 12:35:23 AM11/24/11
to srctea...@googlegroups.com
Bài này do em để n giảm trong vòng for nên nó không bao giờ tăng đến 1000, vì sau mỗi vòng for n lại bị giảm về 0 :) thay vì tách chữ số của n em tách chữ số của m là được.

2011/11/23 nguyen tho <tho.st...@gmail.com>

xem ho e bai nay co van de gi voi!



--
Hoàng Quang Trung
29/06/1991
> D09CNTT4, Post and Telecommunications Institue of Technology 
> Studying and Researching Club
> AppNet team
- Phone: 097 888 9629
- Y!M: Shinichi9629

121.cpp

Trung Hoàng

unread,
Nov 24, 2011, 12:39:54 AM11/24/11
to srctea...@googlegroups.com
Các bạn về làm thử bài kiểm tra hôm trước với yêu cầu chỉ được cấp phát 1 ma trận xem nhé :) và sử dụng tối thiểu số vòng for, bạn nào sử dụng ít nhất số vòng for sẽ được cộng điểm vào bài tới :) Thứ 6 chúng ta sẽ học về hàm và xâu ký tự!

Vào 12:35 Ngày 24 tháng 11 năm 2011, Trung Hoàng <shinic...@gmail.com> đã viết:
Reply all
Reply to author
Forward
0 new messages