473,396 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Error C2084 function 'main' already has a body

So i keep getting this error. The attachment I included is what my teacher wants but together but i keep getting the error when i combine the codes. Thanks in advance. Sorry Im a novice. This my code

Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     system("cls");
  6.  
  7.     printf("\t\t    VENTURA COUNTY COMMUNITY COLLEGE DISTRICT          ");
  8.     printf("\n\t\t\t\t Ventura College                                 ");  
  9.     printf("\n\n\t\t\t     Programming Fundamentals                    ");
  10.     printf("\n\t\t\t\t      CS V11                                     ");
  11.     printf("\n\n\t\t\t\t        By                                     ");
  12.     printf("\n\t\t\t\t Daniel Camarena                                 ");
  13.  
  14.  
  15.     printf("\n\n\n\n");
  16. }
  17.  
  18. #include <stdio.h>
  19.  
  20. int main()
  21. {
  22. //  int A,B,C,D,E;   // how to declare variables separated by COMMAS
  23.  
  24.     int A;
  25.     int B;
  26.     int C;
  27.     int D;
  28.     int E;
  29.  
  30.     A = 1;
  31.     B = 2;
  32.     C = 3;
  33.     D = 4;
  34.     E = 5;
  35.  
  36.     system("cls");
  37.  
  38.  
  39. //  Samples of INTEGER WORLD
  40.  
  41.  
  42. //  Solution to #1
  43.     printf("\n\t\t\tThe value of #1 equation is %4d ", ((A*A)+(B*B))/((C*C)+(D*D))         );
  44.  
  45. //  Solution to #2
  46.     printf("\n\t\t\tThe value of #2 equation is %4d ", ((A*A)+(B*B)-(C*C))/(2*A*B)         );
  47.  
  48. //  Solution to #3
  49.     printf("\n\t\t\tThe value of #3 equation is %4d ", (A*(B-C)*(C-D)*(D-E))/(A+B+C+D+E)   );
  50.  
  51. //  Solution to #4
  52.     printf("\n\t\t\tThe value of #4 equation is %4d ", ((A*A*A)-(B*B*B))/((C*C*C)+(D*D*D)) );
  53.  
  54.  
  55.     printf("\n\n\n\n");
  56. }
Attached Images
File Type: jpg pro.jpg (37.8 KB, 523 views)
Sep 23 '13 #1
3 6560
weaknessforcats
9,208 Expert Mod 8TB
I see two main() functions in the code you posted. You can only have one main() function in a program.
Sep 23 '13 #2
How do you combine the two main functions?
Sep 23 '13 #3
Nepomuk
3,112 Expert 2GB
Simply speaking: By moving the contents of one into the other. You must however be careful when doing this; if one somehow influences the results or output of the other, you must be careful to put the commands in the correct order, maybe rename stuff and possibly even modify the way your code works to a certain extent.
Sep 23 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Lian Liming | last post by:
Hi, all I want to write my own error handler function in php by using "set_error_handler()" function. I have made a test for this function but found it did not work. My test code is as following:...
2
by: ryan.mclean | last post by:
Hello everyone. Hope ya'll had a nice New Year. Anyway, my question is why won't this work? I must be doing something dumb . . . here is the code: in the body tag, I have this code (just to...
8
by: Rody Reulen | last post by:
I made an console application with Visual Basic .net. Visual Basic will automatically create the sub procedure main for you. I try to convert the main procedure to a function. During the...
9
by: Alexander Cohen | last post by:
(sorry for the double post if there is one - i sent the mail to the lisyt from the wrong address) Hi, Im passing this in the commmand line to start up the PostgreSQL server: ../pg_ctl start...
1
by: joe10001 | last post by:
Hi all, I just installed CRELoaded (oscommerce fork) on my server and all work fine except that I have a little message at the bottom of the main page : Fatal error: main() : Security alert:...
0
by: Alun Jones | last post by:
I'm getting the above error in a dialog box from Visual Studio 2005 when trying to sign an assembly using a PFX file, and would like to know how to resolve the problem. Background: The PFX...
7
by: Hexer | last post by:
Hi and good day to all...I am new to the C language and whenever I tried to run the program I made, it won't because it says it has an "expression syntax error in function main"..what I don't get is...
4
by: manjugi | last post by:
Hi, I am running som web application at some point i have one web page contains some buttons,text field etc.when i click on button it gives an error message stating that "error:...
4
by: huggsy | last post by:
I started using C just today and I am having a problem with strrev() function. Here are my codes: #include<stdio.h> #include<conio.h> #include<string.h> main()
1
by: DavidSS | last post by:
I just started programming, and I followed a tutorial to make a calculator. Once I was done, I wanted to make it more advanced, so it wouldn't crash if I try to divide by 0, but instead not giving me...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.