EEEEERRRRRAAAA
Honorary Poster
- Joined
- Oct 28, 2018
- Posts
- 442
- Reaction
- 48
- Points
- 248
- Age
- 25
using array pa help po
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.
opo sir.. ganyan po20 30
11 41
50 80
61 71
Yan ba dapat ang output?
pwede din 20 30 11 41 50 80 61 71 ganyan sir.. pwde din...20 30
11 41
50 80
61 71
Yan ba dapat ang output?
thank you po sir.. gayahin ko to sir. ginawa moTry using 'continue;' to skip specific element from array. Gawa ka condition sa loob ng for loop ng
if (i ==0 || i == 3){
If (j==1 || j == 4){
continue;
}
}
Di ko sure kung magwork to wala akong gamit na pc pero sana nagkaron ka idea.
#include <iostream>
using namespace std;
int main()
{
int arr[4][4] = {{10, 20, 30, 40},
{11, 21, 31, 41},
{50, 60, 70, 80},
{51, 61, 71, 81}
};
for(int i = 0; i < 4; i++){
if(i== 0 || i == 3)
cout<<arr[i][1]<<" "<<arr[i][2];
else
cout<<arr[i][0]<<" "<<arr[i][3];
cout<<endl;
}
return 0;
}
wow .. galing mo naman sir.c++ Code:
C++:#include <iostream> using namespace std; int main() { int arr[4][4] = {{10, 20, 30, 40}, {11, 21, 31, 41}, {50, 60, 70, 80}, {51, 61, 71, 81} }; for(int i = 0; i < 4; i++){ if(i== 0 || i == 3) cout<<arr[i][1]<<" "<<arr[i][2]; else cout<<arr[i][0]<<" "<<arr[i][3]; cout<<endl; } return 0; }