#Simple Static Tip Calculator - Array Division

7 messages · Page 1 of 1 (latest)

gray coral
#

Hello there, I'm just a beginner, so go easy on me pls.
I wrote this code to calculate the tip for each person in a group's separate bill under one single tip bill, but when I execute it I get a weird error? Idk even if its an error. Please help a guy out.

The Code:
#include<stdio.h>
#include<conio.h>
void main()
{
int i,a[50],peo[50],n;
printf("\nEnter the number of people: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("\nEnter the bill amount of person %d",i);
scanf("%d",peo[i]);
a[i]=peo[i]/10;
}
printf("\nTip bill for your group: ");
for(i=1;i<=n;i++)
{
printf("\nPerson %d: %d",i,a[i]);
}
printf("\nThanks for support us! Have a great day!");
getch();
}

The Error(?):
d:/coding with the boys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: d:/coding with the boys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text+0x46): undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status

rugged turret
#

It seems to be working for me. Which IDE are you using?

gray coral
#

Oh, I'm using VSCode with GCC and MingW installed

rugged turret
#
1. Try replacing main() with int main(int argc,char **argv) { }
2. Save as this code as some new file. Again run to compile the code.
3. Check the PATH environment variable.
spark zealotBOT
#

Hello there, I'm just a beginner, so go easy on me pls.
I wrote this code to calculate the tip for each person in a group's separate bill under one single tip bill, but when I execute it I get a weird error? Idk even if its an error. Please help a guy out.

The Code:

#include <conio.h>
#include <stdio.h>
void main() {
  int i, a[50], peo[50], n;
  printf("\nEnter the number of people: ");
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    printf("\nEnter the bill amount of person %d", i);
    scanf("%d", peo[i]);
    a[i] = peo[i] / 10;
  }
  printf("\nTip bill for your group: ");
  for (i = 1; i <= n; i++) {
    printf("\nPerson %d: %d", i, a[i]);
  }
  printf("\nThanks for support us! Have a great day!");
  getch();
}

The Error(?):
d:/coding with the boys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: d:/coding with the boys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text+0x46): undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status

PurelyEerie
spark zealotBOT
#

This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.