#include<iostream>
#include<fstream.h>
usingnamespace 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'
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.