I was writing a c++ code but it returns error. I have just started c++ and i don't know how to rectify it this is the error :
tempCodeRunnerFile.cpp:5:1: error: '::main' must return 'int'
5 | void main()
| ^~~~
tempCodeRunnerFile.cpp: In function 'int main()':
tempCodeRunnerFile.cpp:8:5: error: 'clrscr' was not declared in this scope
8 | clrscr();
|
this is my code: I want to input two numbers and return "Variable one is greater" if first variable is greater and if second is greater then "second variable is greater"
#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
clrscr();
int vari,vari2;
cout<<"Enter a Variable: ";
cin>>vari;
cout<<"Enter Another Variable: ";
cin>>vari2;
if (vari>vari2){
cout<<"Variable 1 was greater";
}
else if (vari=vari2)
{
cout<<"Variables Are Equal";
}
else
{
cout<<"Variable 2 is Greater";
}
getch();
}