Please what should i use after int main() has been defined in C++ | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Please what should i use after int main() has been defined in C++

int main() { a=32 b=12 }

16th Oct 2020, 11:44 PM
Ultra WALKER
Ultra WALKER - avatar
30 Réponses
+ 7
What do you want to do?
16th Oct 2020, 11:46 PM
Abhay
Abhay - avatar
+ 8
Lmao, it's kinda funny to see you accepted Abhay's answer, and it's actually a question.
17th Oct 2020, 3:58 AM
LastSecond959
LastSecond959 - avatar
+ 2
Y u repeat the same thing again? In the first part ur code has been already done...
17th Oct 2020, 2:09 PM
Sristi Kushwaha
Sristi Kushwaha - avatar
+ 1
Ultra WALKER you can't define main function again ,it's the entry point of your app ,any logic to be executed should be written inside the main method ,as far as I understand from the error you are trying to re define the main() which you simply can't as I already said
17th Oct 2020, 12:00 AM
Abhay
Abhay - avatar
+ 1
Ultra WALKER show your code ,copy paste the link of it here,so one can understand what you are trying to do
17th Oct 2020, 12:03 AM
Abhay
Abhay - avatar
+ 1
#include <iostream> using namespace std; int sum(int a,int b) { return a+b; } int main () { cout << sum(30,12); return 0; }
17th Oct 2020, 12:19 AM
Ali Abdulsalam
Ali Abdulsalam - avatar
+ 1
If U want to creat an app...bt before that u have to learn basics of c++ ....first clear ur basics nd then start.... definitely u can do it..☺️
18th Oct 2020, 5:38 AM
Sristi Kushwaha
Sristi Kushwaha - avatar
+ 1
It's better you create a class because you can only define int main() once in C++ code and then use inheritance and polymorphism
18th Oct 2020, 11:49 AM
Programmado
Programmado - avatar
0
I want to practice with it but the compiler keeps saying ERROR RE-DEFINITION OF INT MAIN() INT MAIN() HAS BEEN PREVIOUSLY DEFINED
16th Oct 2020, 11:48 PM
Ultra WALKER
Ultra WALKER - avatar
0
So what do i do if i cant redefine int main() i tried void main() but an error occured and i tried int b()
17th Oct 2020, 12:02 AM
Ultra WALKER
Ultra WALKER - avatar
0
But nothing happened
17th Oct 2020, 12:02 AM
Ultra WALKER
Ultra WALKER - avatar
17th Oct 2020, 12:04 AM
Ultra WALKER
Ultra WALKER - avatar
0
Ultra WALKER that works fine ,what were you talking about?
17th Oct 2020, 12:05 AM
Abhay
Abhay - avatar
0
read the second part am trying to add on
17th Oct 2020, 12:07 AM
Ultra WALKER
Ultra WALKER - avatar
0
int void() or is it wrong if so what do i type
17th Oct 2020, 12:07 AM
Ultra WALKER
Ultra WALKER - avatar
0
#include <iostream> using namespace std; int main() { int a = 30; int b = 12; int sum = a + b; cout << sum; return 0; }
17th Oct 2020, 12:15 AM
Ali Abdulsalam
Ali Abdulsalam - avatar
0
Thats all noting after that
17th Oct 2020, 12:15 AM
Ultra WALKER
Ultra WALKER - avatar
0
Please i want to create a reminder app in C++ how do i start
17th Oct 2020, 10:59 AM
Ultra WALKER
Ultra WALKER - avatar
0
like it's not a must to start with int you can start with main() { }
17th Oct 2020, 10:42 PM
Kelvin Gin
0
Please am creating an app where do i start from
17th Oct 2020, 10:43 PM
Ultra WALKER
Ultra WALKER - avatar