Results 1 to 6 of 6
Thread: C++
Hybrid View
-
29th May 2011 03:33 #1
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];
}
...
... , , () ? . ?! ? ?
-
29th May 2011 07:51 #2Registered 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
-
29th May 2011 10:15 #3
, .
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
-
29th May 2011 23:03 #4Registered User
Join Date: Dec:2007
Location: Sofia
Posts: 366
-
29th May 2011 23:48 #5
, 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
-
30th May 2011 01:15 #6
!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["<< i <<"]["<< j <<"] = ";
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 ...
?




Reply With Quote

Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in