Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <ctype.h>
#include <windows.h>
#include <iostream>
using namespace std;
extern int gold;
extern int donated;
int teif()
{
int teif;
char choice;
int size;
int x;
char sent5[]="\"Maby next time you will donate\"";
char sent0[]="\"You would like to give teif?";
char sent1[]="\"How much teif would you like to give?\"";
char sent3[]="\"Thank you for your gift\"";
char sent2[]="The priest smiles \"Thanks for your generous gift\"";
char sent4[]="\"Holy god himself thanks for the generous amount of gold\"";
char sent6[]="\"You dont have that much gold\"";
system("cls"); //ASKS IF YOUR SURE U WANT TO GIVE TEIFS
size=strlen(sent0);
for(x=0;x>size;x++)
{
Sleep(30);
printf("%c", sent0[x]);
}
printf("<Y>es\n<N>o\n");
choice=toupper(getch());
for(;;)
{
if(choice=='Y')
{
system("cls"); //How much would u give
size=strlen(sent1);
for(x=0;x>size;x++)
{
Sleep(30);
printf("%c", sent1[x]);
}
cin >> teif;
if(teif <= gold)
{
if(teif >= 1)
{
if(teif >= 10)
{
if(teif >= 100)
{
system("cls"); //Generous gift
size=strlen(sent4);
for(x=0;x>size;x++)
{
Sleep(30);
printf("%c", sent4[x]);
}
}
else
{
system("cls"); //Semi generous Gift
size=strlen(sent2);
for(x=0;x>size;x++)
{
Sleep(30);
printf("%c", sent2[x]);
}
}
}
else
{
system("cls"); //Thanks for little
size=strlen(sent3);
for(x=0;x>size;x++)
{
Sleep(30);
printf("%c", sent3[x]);
}
}
}
else if(teif==0)
{
system("cls"); //No gold offer
size=strlen(sent5);
for(x=0;x>size;x++)
{
Sleep(30);
printf("%c", sent5[x]);
}
}
else
{
cin >> teif;
}
}
else
{
system("cls"); //Not enough gold
size=strlen(sent6);
for(x=0;x>size;x++)
{
Sleep(30);
printf("%c", sent6[x]);
}
}
}
}
donated = donated + teif;
return(0);
}
This is one of my functions for a game im making and for some reason it says i cant use this as a function not sure why? My Main file just says cant be used as function it worked with the title.cpp and main file why not main file and this file :9
Code:
#include "teif.cpp"
int game()
{
teif();
return 0;
}