kiem tien, kiem tien online, kiem tien truc tuyen, kiem tien tren mang
Chủ Nhật, 15 tháng 2, 2015

#include <iostream>
#include <iomanip>
#include <string.h>
using namespace std;

int strLength(string str){
    int len=0;
    while(str[len]!='\0'){
        len=len+1;
    }
    return len;
}

string toUpper(string str){
    for(int i=0;i< strLength(str);i++){
       char value = str[i];
       if (value>='a' && value<='z'){
            str[i]=(value-32);
       }
    }
    return str;
}
string toLower(string str){
    for(int i=0;i< strLength(str);i++){
       char value = str[i];
       if (value>='A' && value<='Z'){
            str[i]=(value+32);
       }
    }
    return str;
}
//
string toProper(string str){

    return str;
}

struct SinhVien{
    int MSSV;
    string HoTen;
    float DiemToan;
    float DiemLy;
    float DiemHoa;
    float DiemTB;
};

void Nhap1SV(SinhVien &sv){
    cout<<"\tMSSV: ";
    cin >> sv.MSSV;
    cin.ignore();
    cout<<"\tHo ten: ";
    getline(cin,sv.HoTen);
    cout<<"\tDiem T,L,H: ";
    cin >> sv.DiemToan
        >> sv.DiemLy
        >> sv.DiemHoa;
    sv.DiemTB = (sv.DiemHoa + sv.DiemLy + sv.DiemToan) / 3.0;
}
void In1SV(SinhVien sv){
    cout<<setw(8)<<sv.MSSV
        <<setw(14)<<sv.HoTen
        <<setw(8)<<sv.DiemToan
        <<setw(6)<<sv.DiemLy
        <<setw(6)<<sv.DiemHoa
        <<setw(9)<<sv.DiemTB
        <<endl;
}

void nhapDSSV(SinhVien *&dsSV,int &n){
    cout<<"DS co nhieu sv? ";
    cin >> n;
    dsSV = new SinhVien[n];
    for(int i=0;i<n;i++){
        cout<<"SV["<<i<<"]: \n";
        Nhap1SV(dsSV[i]);
    }
}
void inDSSV(SinhVien *dsSV,int n){
    cout<<"\n\nIn thong tin: \n\n";
    cout<<setw(8)<<"MSSV"
        <<setw(14)<<"HoTen"
        <<setw(8)<<"Toan"
        <<setw(6)<<"Ly"
        <<setw(6)<<"Hoa"
        <<setw(9)<<"DiemTB"
        <<endl;
   for(int i=0;i<n;i++){
            In1SV(dsSV[i]);
   }

}
int main(){
    int n;
    SinhVien *dsSV;
    nhapDSSV(dsSV,n);
    inDSSV(dsSV,n);
    return 0;
}
15 Feb 2015

0 nhận xét:

Đăng nhận xét

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

domain, domain name, premium domain name for sales

Bài đăng phổ biến