Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

The token that the error refers to is on line 4-expected unqualified id before '{'

0 votes
asked Apr 25, 2020 by WilliamPFowler (140 points)
#include<iostream>
using namespace std;
int main ();
int i=0;{
for (int i = 0; i < 25; i++)
  {
    cout << "Hello World\n";
  }
  return 0;
}
//*************************

2 Answers

0 votes
answered Apr 26, 2020 by MK (240 points)

The opening bracket at the end of line 4 is causing the error.
The opening bracket shall be before line 4 and in line 3 semicolon at the end will cause an error too.,

Your code should look like this:
 

#include<iostream>
using namespace std;
int main ()
{
int i=0;
for (int i = 0; i < 25; i++)
  {
    cout << "Hello World\n";
  }
  return 0;
}
//************************* 

0 votes
answered Apr 26, 2020 by LiOS (6,420 points)
Line 3 - { required instead of ;
Line 4 - Remove {

#include <iostream>

using namespace std;

int main(){
    int i = 0;
    
    for (i = 0; i < 25; i++){
        cout << "Hello World\n";
    }
    
    return 0;
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...