Trying to figure out how to fix this cod

#include<iostream.h>
#include<conio.h>
#include <stdio.h>
#include <stdlib.h>
void main()
{
int a[10][10];
int i,j;
float average;
int sum=0;
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
a[i][j] = rand()%100+1;
}
}
cout<<"Elements of array are"<<endl;
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
cout<<a[i][j];
}
}
cout<<endl;
cout<<"Elements of array after sorting"<<endl;
for(int row = 0; row < 10; row++)
{
for(int i=0;i<10;i++)
{
for(int j=i;j<10;j++)
{
if(MyArray[row][i]<MyArray[row][j])
{
int temp= a[row][i];
a[row][i]=a[row][j];
a[row][j]=temp;
}
}
}
}
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
cout<<a[i][j];
sum = sum+a[i][j];
}
}
cout<<endl;
average = sum/10;
cout<<"Sum of elements of array is"<<sum<<endl;
cout<<"Average of elements of array is"<<average<<endl;
}

Error 1 error C1083: Cannot open include file: 'iostream.h': No such file or directory c:\cpp8\chap 12\twodimeasionalarray\twodimeasionalarray\twodimesionalarray.cpp 1 1 TwoDimeasionalArray

2 IntelliSense: cannot open source file "iostream.h" c:\Cpp8\Chap 12\TwoDimeasionalArray\TwoDimeasionalArray\twodimesionalarray.cpp 1 1 TwoDimeasionalArray

3 IntelliSense: identifier "cout" is undefined c:\Cpp8\Chap 12\TwoDimeasionalArray\TwoDimeasionalArray\twodimesionalarray.cpp 18 1 TwoDimeasionalArray

4 IntelliSense: identifier "endl" is undefined c:\Cpp8\Chap 12\TwoDimeasionalArray\TwoDimeasionalArray\twodimesionalarray.cpp 18 32 TwoDimeasionalArray

5 IntelliSense: identifier "MyArray" is undefined c:\Cpp8\Chap 12\TwoDimeasionalArray\TwoDimeasionalArray\twodimesionalarray.cpp 34 4 TwoDimeasionalArray

Your code does not compile. Here is the code that compiles :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include<iostream.h>
#include<conio.h>
#include <stdio.h>
#include <stdlib.h>
void main()
{
int a[10][10];
int i,j;
float average;
int sum=0;
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
a[i][j] = rand()%100+1;
}
}
cout<<"Elements of array are"<<endl;
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
cout<<a[i][j];
}
}
cout<<endl;
cout<<"Elements of array after sorting"<<endl;
for(int row = 0; row < 10; row++)
{
for(int i=0;i<10;i++)
{
for(int j=i;j<10;j++)
{
if(a[row][i]<a[row][j])
{
int temp= a[row][i];
a[row][i]=a[row][j];
a[row][j]=temp;
}
}
}
}
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
cout<<a[i][j];
sum = sum+a[i][j];
}
}
cout<<endl;
average = sum/10;
cout<<"Sum of elements of array is"<<sum<<endl;
cout<<"Average of elements of array is"<<average<<endl;
}
This code I am getting the same error.
Error 1 error C1083: Cannot open include file: 'iostream.h': No such file or directory c:\cpp8\chap 12\twodimeasionalarray\twodimeasionalarray\twodimesionalarray.cpp 1 1 TwoDimeasionalArray

2 IntelliSense: cannot open source file "iostream.h" c:\Cpp8\Chap 12\TwoDimeasionalArray\TwoDimeasionalArray\twodimesionalarray.cpp 1 1 TwoDimeasionalArray

3 IntelliSense: identifier "cout" is undefined c:\Cpp8\Chap 12\TwoDimeasionalArray\TwoDimeasionalArray\twodimesionalarray.cpp 18 1 TwoDimeasionalArray

4 IntelliSense: identifier "endl" is undefined c:\Cpp8\Chap 12\TwoDimeasionalArray\TwoDimeasionalArray\twodimesionalarray.cpp 18 32 TwoDimeasionalArray
Then you try this then.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main()
{
int a[10][10];
int i,j;
float average;
int sum=0;
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
a[i][j] = rand()%100+1;
}
}
cout<<"Elements of array are"<<endl;
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
cout<<a[i][j];
}
}
cout<<endl;
cout<<"Elements of array after sorting"<<endl;
for(int row = 0; row < 10; row++)
{
for(int i=0;i<10;i++)
{
for(int j=i;j<10;j++)
{
if(a[row][i]<a[row][j])
{
int temp= a[row][i];
a[row][i]=a[row][j];
a[row][j]=temp;
}
}
}
}
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
cout<<a[i][j];
sum = sum+a[i][j];
}
}
cout<<endl;
average = sum/10;
cout<<"Sum of elements of array is"<<sum<<endl;
cout<<"Average of elements of array is"<<average<<endl;
}
THANK YOU VERY MUCH
Topic archived. No new replies allowed.