Results 1 to 6 of 6

Thread: C++

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    jonyshub's Avatar
    Join Date: Dec:2008
    Location: athens
    Posts: 57

    C++

    ! ? :
    . , .
    :
    #include < iostream.h >
    int main(){
    // :
    double m[2][3];
    int i,j;
    // " " "for" :
    for(i=0;i<2;i++)
    for(j=0;j<3;j++)
    {
    cout<<" m["<< i <<"]["<< j <<"] = ";
    cin>>m[i][j];
    }
    ...
    ... , , () ? . ?! ? ?

  2. #2
    Registered User
    Join Date: Apr:2009
    Location: Plovdiv
    Posts: 30
    , , 2*3 , . .
    Code:
    #include < iostream.h >
    int main(){
    //        :
    double m[2][3], n[6];	//dobavq6 i ednomeren masiv, v koito suhranqva6 otgovorite
    int k=0;//broq4 za negativnite elementi
    int i,j;
    // "  "   "for"      :
    for(i=0;i<2;i++)	
    for(j=0;j<3;j++)
    {
    cout<<" m["<< i <<"]["<< j <<"] = ";
    cin>>m[i][j];
    if(m[i][j]<0) //negative check
      { n[k]=m[i][j];
         k++;
      }
    }
    //output the final array
    cout<<endl;
    if(k>0)
       {
       for(i=0;i<k;i++)
          cout<<n[i]<<" ";
       }
    return 0;
    }


    martosss
    : Hp Probook 4510s

  3. #3
    Registered User martinhr's Avatar
    Join Date: Jul:2008
    Location: /dev/random
    Posts: 331
    , .
    PHP Code:
        int main()
        {
            
            
            
            
    int a[3][2];
            
    int k=0;
            
            for(
    int i=0;i<=3;i++)
            for(
    int m=0;m<=2;m++)
            {
            
    cout<<"element a["<<i<<"]["<<m<<"]"<<endl;
            
    cin>>a[i][m];
            }

            for(
    int j=0;j<3;j++)
            for(
    int d=0;d<2;d++){
                if(
    a[j][d]<0)
                {
                        
    k++;
                }
                
        
        }
            if(
    k==0){
                
            
    cout<<"There are no negative numbers"<<endl;
            }
            else
            {
                if(
    k==1)
                {
                    
    cout<<"There is only one negative number"<<endl;
                }
                else
                {
                
    cout<<"There are "<<k<<" negative numbers"<<endl;
                }
            }

    ThinkPad T520 ( 4243F53 ) | Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz | Crucial 8GB Ballistix Sport DDR3 @ 1333MHz | SAMSUNG 850 Pro Series ( MZ-7KE128BW ) 128GB 3-D Vertical | Seagate FireCuda Gaming SSHD 2TB ( ST2000LX001 ) | Kernel: 4.4.0-24-generic x86_64 Distro: Ubuntu 16.04 xenial

  4. #4
    Registered User
    Join Date: Dec:2007
    Location: Sofia
    Posts: 366
    Quote Originally Posted by martinhr View Post
    , .
    , .

    Canar1912 , - 2 3 - , .

  5. #5
    Registered User martinhr's Avatar
    Join Date: Jul:2008
    Location: /dev/random
    Posts: 331
    , 32 23. !
    ThinkPad T520 ( 4243F53 ) | Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz | Crucial 8GB Ballistix Sport DDR3 @ 1333MHz | SAMSUNG 850 Pro Series ( MZ-7KE128BW ) 128GB 3-D Vertical | Seagate FireCuda Gaming SSHD 2TB ( ST2000LX001 ) | Kernel: 4.4.0-24-generic x86_64 Distro: Ubuntu 16.04 xenial

  6. #6
    jonyshub's Avatar
    Join Date: Dec:2008
    Location: athens
    Posts: 57

    PHP Code:
    #include <iostream> 
    using namespace std;
    int main(){
    //        :
    double m[2][3], n[6];    //       :
    int k=0;//    :
    int i,j;
    // "  "   "for"      :
    for(i=0;i<2;i++)    
    for(
    j=0;j<3;j++)

    {
    std::cout <<"Vuvedete m["<< <<"]["<< <<"] = ";
    std::cin>>m[i][j];
    if(
    m[i][j]<0//     :

      
    n[k]=m[i][j];
         
    k++;
      }
    }
    //  :
    std::cout<< std::endl;
    if(
    k>0)
       {
       for(
    i=0;i<k;i++)
          
    cout<<n[i]<<" ";
       };
       
    system("pause");
    return 
    0;

    !

    - .
    ( ) . 90% , ( ...). , , . , -, : http://www.sharewareconnection.com/t...-flowchart.htm ...
    ?

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 |