Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main()
- {
- int t[12];
- fstream f;
- f.open("in.txt",ios::in);
- int i=0;
- while(i<12){
- f>>t[i];
- i++;
- }
- f.close();
- int osszeg=0;
- int poz;
- i=2;
- while(i<12){
- if(t[i]+t[i-1]+t[i-2]>osszeg){
- osszeg=t[i]+t[i-1]+t[i-2];
- poz=i;
- }
- i++;
- }
- cout<<"A legnagyobb reszosszeg: "<<osszeg<<endl;
- cout<<"Az alabbi honapokban: "<< poz-1 <<". "<< poz <<". "<< poz+1 <<". "<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement