Files. First attempt, problem

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
#include<iostream>
#include<fstream.h>
using namespace std;

class Student
{
      public:
              Student();
              ~Student();
              void Show();

              char name[30];
              char EGN[10];
};

Student::Student()
{
         cout<<"Vuvedi ime na u4enik";
         cin>>name;
         cout<<"Vuvedi EGN";
         cin>>EGN;
         
};

Student::~Student()
{
          cout<<"Obekta ve4e go nemA";
};

void Student::Show()
{
     cout<<"\n";
     cout<<"Imeto na u4enika e "<<name;
     cout<<"EGn-to e "<<EGN;
};
int main()
{
    int n;
    cout<<"vuvedi br. u4enici";
    cin>>n;
    Student uchenici[n];
    ofstream file;
    file.open("MyFirst.txt",ios::out);
    {
    for(int i=0;i<n;i++)
    uchenici[i].Show();
    file<<uchenici[i].name;
    file<<uchenici[i].EGN;
    }

system("pause");
return 0;
}


this is the code;
32:2 C:\Users\lubomir\Desktop\Lubo\Dev-Cpp\include\c++\3.4.2\backward\backward_warning.h #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.

2 C:\Users\lubomir\Desktop\Lubo\Dev-Cpp\include\c++\3.4.2\backward\fstream.h:31, from C:\Users\lubomir\Desktop\FilesC++\FilesLubo.cpp In file included from C:/Users/lubomir/Desktop/Lubo/Dev-Cpp/include/c++/3.4.2/backward/fstream.h:31, from C:\Users\lubomir\Desktop\FilesC++\FilesLubo.cpp

C:\Users\lubomir\Desktop\FilesC++\FilesLubo.cpp In function `int main()':

47 C:\Users\lubomir\Desktop\FilesC++\FilesLubo.cpp name lookup of `i' changed for new ISO `for' scoping

45 C:\Users\lubomir\Desktop\FilesC++\FilesLubo.cpp using obsolete binding at `i'


I need your help guys :(

The open brace on your for loop '{', Line 44, seems to be above the actual loop on Line 45. I agree the compiler error on that one is a little off putting so don't feel bad about it.
Thank u a lot!
Topic archived. No new replies allowed.