expected init-declarator before "char"

I'm basically the noobiest C++ person ever.
I got this error while doing a program... and I googled around trying to figured out and it said that I may have an extra <<cout statement but, I can't seem to figure out the error, and thought I would come here to let my issue be seen by wiser eyes... dont make fun of me


//Program: Roll dice

#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

int rollDice(int num);
int num;
int main ()
char response;
{ //Gather information
cout << "Enter number you want the two dice to equal: ";
cin >> num;
//The dice are rolled
cout << "The number of times the dice are rolled to get the sum" << num <<"="<<
rollDice(num) << endl;
//The user is prompted and asked if they would like to roll the dice again.
cout << "Would you like to roll the dice again? (Y,y/N,n):";
cin >> response;
cout << endl;
//While loop, when user answers with 'Y' or 'y'
while (response == 'Y'|| response == 'y')
{
//user answers 'Y' or 'y' and is prompted to enter a number
do
{
cout << "Enter the sum of the numbers, (2 to 12),"
<< "to be rolled: ";
cin >> num;
}
//Makes sure the numbers are those that can be rolled on two dice
while(num < 2|| num > 12);
//Finishes up the loop and displays the roll
cout << "The number of times the dice are "
<< "rolled to get the sum " << num << "=" << rollDice(num) << endl;
cout << "Would you like to roll the dice again? (Y,y/N,n):" << endl;
cin >> response;
cout << endl;
}

return 0;
}
//rollDice function definition
int rollDice(int num)
{
int die1;
int die2;
int sum;
int rollCount = 0;

srand(time(0));

do
{
die1 = rand() % 6 + 1;
die2 = rand() % 6 + 1;
sum = die1 + die2;
rollCount++;
}
while (sum != num);

return rollCount;
}
Ugh, I think this post is horribly formatted, how do I make it look better?
my friend helped me

"You have int main() immediately followed by char response;, then your open bracket. Move the response declaration inside the bracket."

Gah, I'm stupid, thanks everyone
In the future, if you need to post code, use the code tags:
[code]Code goes here[/code]

Also, you can mark your thread solved at the top of the thread to let other users know that you no longer need help and so that someone that's looking for a solution knows that one has been found for that topic.

And don't beat yourself up too much, you'll learn that you can make the dumbest mistakes and stare at the screen for hours or days before realizing you missed a semicolon somewhere or that you put a 1 instead of an i. The more you learn, the more extravagant your mistakes can get and the harder it can be to locate them. Best of luck and welcome to the forums.
Topic archived. No new replies allowed.