Hello guys,
anyone here will try to correct my code in determining the highest and lowest value when entering 12 integers..I already have the code but the highest and lowest value will not appear..thanks in advance
-----------------------------------
#include <iostream>
using namespace std;
int main(){
int i;
int j;
int n[3][4];
int low;
int high;
cout<<"Enter 12 values:";
for(int i=0;i<3;i++)
for(int j=0;j<4;i++)
cin>>n[i][j];
high = n[0][0];
for(int i=0;i<3;i++)
for(int j=0;j<4;i++){
if(high<n[i][j])
high=n[i][j];
That's not necessary. The problems are missing curly braces after the first, second, third and fifth for loops, and the three loops that have j as the counter variable are incrementing i instead.
hmm..interesting thing,because there is only one instruction in the for loop,so no need for braces.and there are some more mistakes,no wonder that you're program cracks and does not work..read again what you wrote.
and that mistake is repeated in every for loop.i guess u just copy pasted it all over.
and u declared the values i and j at the start of the program..perfectly ok.but why you repeated you're self in the for loops??..for(int i=0;i<3;i++) and so one...it is not a sintax error but you complicate the code to much,and it makes harder to understand.for a very simple program like this..
So for a tip,all you're code twice and try to figure out what it does before u run it..good luck :)