Results 1 to 2 of 2

Thread: C++

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date: Apr:2005
    Location: varna
    Posts: 11

    C++

    0,5! ... :
    Code:
    #include <iostream>
    #include <iomanip>
    using namespace std;
    
    class student{
          public:
             string name;
             double weight[30];
             }student[100];
             
         
      int n; 
    int main()
    {
          double sredno_teglo=0;
    int n;
       do{
           cout<<"Number of students:";
           cin>> n;
           }while (n<1||n>30);
           int i;
           for (i=0;i<=n-1;i++)
              {
              cout<<"Ime na studenta:";
              cin>>student[i].name;
              cout<<"Teglo na studenta:";
              cin>>student[i].weight[i];
              cout<<endl;
               }
               
            for (int i=0;i<n;i++)
            {
                sredno_teglo+=student[i].weight[i];
                }
          cout<<"Srednoto teglo na studentite e:";  
          cout<< fixed << setprecision(1)<<sredno_teglo/n;
          cout<<endl;
          
           
        system("PAUSE");
        return 0;
    }
    cout. ?!?!?

  2. #2
    Banned haste's Avatar
    Join Date: Mar:2006
    Location:
    Posts: 759
    setprecision(int) , () , .

    , :
    - ;
    - " " - , , "";
    - Comparing floating point numbers
    ;
    - Minimax Approximations and the Remez Algorithm;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |