My problem is as said "expected ';' before "int" "
I dont the problem =>

This obviusly aint the hole text, rather its the place where its complaining.

int tarning2(void)
{
    return(tarning1()+tarning1());
}
int tarning1(void)
{
    int max = 6, min = 1;
    return (rand()%(max-min+1)+min);
}

This might have something to do with it:
int tarning1(void);
int tarning2(void);
void main()

What Im trying to do is a dice game.
I've tryed change void main to int main and adding a return 0; , however it still complains.

Heres the exact complaints:
`main' must return `int'
In function `int main(...)':

Also wondering what this is:
1 D:\ANNAT\Dev-Cpp\include\c++\3.4.2\backward\iostream.h:31, from CRY\DICE.cpp In file included from D:/ANNAT/Dev-Cpp/include/c++/3.4.2/backward/iostream.h:31, from CRY/DICE.cpp

Edited 5 Years Ago by Narue: Added code tags

Put training1 definition above training2 definition. Also put a "return 0;" in the last line in main. Also use "#include<iostream>" not #include <iostream.h>"

Could you post all of the code? The place where it's complaining isn't necessarily the source of the error.

Also wondering what this is:
1 D:\ANNAT\Dev-Cpp\include\c++\3.4.2\backward\iostream.h:31, from CRY\DICE.cpp In file included from D:/ANNAT/Dev-Cpp/include/c++/3.4.2/backward/iostream.h:31, from CRY/DICE.cpp

GCC boilerplate in an error log. While it can be helpful, a lot of the time you can ignore these lines.

It still complains on `main' must return `int'
I added the return 0;
But I guess I need to make it int main, however wont that make my int tarning1(void);
go bad?

Heres the part about the training part:

int tarning2(void){
return(tarning1()+tarning1());
}
int tarning1(void){
int max = 6, min = 1;
return (rand()%(max-min+1)+min);
}


I also got:
[Build Error] [PROV/DICE.o] Error 1

Edited 5 Years Ago by DeusManP0W: n/a

#include <iostream>
#include <stdlib.h>
#include <conio.h>
#include <iomanip.h>
#include <time.h>
int tarning1(void);
int tarning2(void);
char cont1 ='Q',cont2='Q';
int OnGoing =1,OnGoing1=1,OnGoing2=1;
int resultat, summa=0,points1=0,points2=0;
void main(){
while(OnGoing != 0){
              cout<<"Its player ones turn, do you wish to continue[Y] or stop[N]?";
              cin>>cont1;
           
                    if(cont1 == 'Y'){
                             OnGoing1 =0;
                             while(OnGoing1 == 0){
                                            
                          
                                  srand( (unsigned)time(NULL));        
                                  resultat=tarning2();
                                  points1=points1+resultat;
                                  int throw1=0; throw1++;
                                  cout<<"Points: "<<points1<<"           Throws: "<<throw1<<endl;
                                                   if(summa >40){
					                                 cout<<"Player one have excedded 40 and have automaticly lost.";
	                                                 OnGoing1 =1;
                               }
                           }
                            }else{     
                                      cout<<"Its player two's turn, do you wish to continue[Y] or stop[N]?";
                                      if(cont2 == 'Y'){  
                                               OnGoing2 =0;
                                             } while(OnGoing2==0){
                                                resultat=tarning2();
                                                points2=points2+resultat;
                                                int throw2=0; throw2++;
                                                cout<<"Points: "<<points2<<"           Throws: "<<throw2<<endl;
                                                    if(summa >40){
					                                       cout<<"Player two have excedded 40 and have automaticly lost.";
	                                                       OnGoing2 =1;
                                      }
                                  }                                    
                              }   
                         }
                         return 0;
}

int tarning2(void){
    return(tarning1()+tarning1());
}
int tarning1(void){
    int max = 6, min = 1;
    return (rand()%(max-min+1)+min);
}

Edited 5 Years Ago by Narue: Added code tags

I realise its not complete, its just my rough sketch so far.
However I want it to work so I can know if the while and ifs parts actually work.

Ok, I am now slowly fixing the script.
I'll let you all know how it goes tomorrow, really gotta sleep now though.
Goodnight all.

Edited 5 Years Ago by DeusManP0W: n/a

you can't return anything in your "void main()" function as you did in line 47.... though I use an int main().

I have completed it! Halleuja. God bless the Queen of Britania!

This thread can now be considered resolved.

Edited 5 Years Ago by DeusManP0W: n/a

This article has been dead for over six months. Start a new discussion instead.