CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Warning:no return statement in function returning non-void [-Wreturn-type]

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 24, 2022, 12:18
Post Warning:no return statement in function returning non-void [-Wreturn-type]
  #1
New Member
 
Yumna
Join Date: Dec 2022
Posts: 1
Rep Power: 0
Yumna Athif is on a distinguished road
Hi everyone,
I'm compiling coding for a periodic table in Dev C++, but I'm using c programming language. I met a warning "no return statement in function returning non-void [-Wreturn-type]" when compiling. This warning occurred in the last line, getch();}} line 335.
This is very long but still, can someone help me figure out how to get rid of this error? Thank you so much in advance.

The code is:

#include<stdio.h>
#include<conio.h>
int main();
char clrscr()
{
int
gpn,atm,prdnm,i,a[]={5,13,31,49,81},b[]={6,14,32,50,83},c[]={7,15,33,51,83},d[]={8,16,34,52,84},e[]={9,17,35,53,85},f[]={2,10,18,36,54,86};
int *fe,*ae,*be,*ce,*de,*ee;
char ch;
clrscr();
ae=&a[0];
be=&b[0];
ce=&c[0];
de=&d[0];
ee=&e[0];
fe=&f[0];
printf("\n\t************************************** ***********");
printf("\n\t* PERODIC TABLE *");
printf("\n\t************************************** ***********\n\n");


printf("\n\t\t\t ~~~~~~~~~~~~~~~~~");
printf("\n\t\t\t| |");
printf("\n\t\t\t| P block |");
printf("\n\t\t\t| |");
printf("\n\t\t\t ~~~~~~~~~~~~~~~~~\n\n");
z: ;
{
printf("\n\t#Enter the atomic number = ");
scanf("%d",&atm);
if(atm>=5&&atm<=10)
{
printf("\n\t#period = 2");
}
else if(atm>=13&&atm<=18)
{
printf("\n\t#period =3");
}
else if(atm>=31&&atm<=36)
{
printf("\n\t#period =4");
}
else if(atm>=49&&atm<=54)
{
printf("\n\t#period =5");
}
else if(atm>=81&&atm<=86)
{
printf("\n\t#period =6");
}
else
{
printf("\n\t\t!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!");
printf("\n \t\t\tELEMENT NOT IN THIS BLOCK");
}
{
for(i=0;i<=4;i++)
{
if(*(ae+i)==atm)
{
gpn=13;
printf("\n \t\t\tBORON family");
printf("\n\t\t#group number=13");
}}}
{for(i=0;i<=4;i++)
{if(*(be+i)==atm){
gpn=14;
printf("\n\t\t CARBON family");
printf("\n\t\t#group number=14");
}}}{
for(i=0;i<=4;i++)
{ if(*(ce+i)==atm){
gpn=15;
printf("\n\t\t NITROGEN family or pnicogen");
printf("\n\t\t#group number=15");
}}}{
for(i=0;i<=4;i++)
{if(*(de+i)==atm){
gpn=16;
printf("\n\t\t OXYGEN family");
printf("\n\t\t#group number=16");
}}}
{
for(i=0;i<=4;i++)
{
if(*(ee+i)==atm)
{
gpn=17;
printf("\n\t\t HALOGEN family");
printf("\n\t\t#group number=17");
}
}}
{
for(i=0;i<=5;i++)
{
if(*(fe+i)==atm)
{
gpn=18;
printf("\n\t\t NOBLE gases");
printf("\n\t\t#group number =18");
}
}}
switch(gpn){
case 13:
if (atm==5)
{
printf("\n\t\t#element name= boron");
printf("\n \t\t#element symbol=b");
printf("\n \t\t#semimetal in nature");
}
else if(atm==13)
{
printf("\n\t\t#element name= aluminum");
printf("\n\t\t#element symbol= al");
printf("\n\t\t#non metel in nature");
}
else if(atm==31)
{
printf("\n\t\t#element name= gallium");
printf("\n\t\t#elemant symbol= ga");
printf("\n\t\t#poor metal in nature");
}
else if(atm==49)
{
printf("\n\t\t#element name= indium");
printf("\n\t\t#element symbol= In");
printf("\n\t\t#poor metal in nature");
}
else if(atm==81)
{
printf("\n\t\t#element name= thalium");
printf("\n\t\t#element symbol= Tl");
printf("\n\t\t#poor metal in nature");
}
else
{
printf(" \n\t\t#elemet not in this group ");
}
goto y;
case 14:
if(atm==6)
{
printf("\n\t\t#element name= carbon");
printf("\n\t\t#element symbol= C");
printf("\n\t\t#nometal in nature");
}
else if(atm==14)
{ printf("\n\t\t#element name= silicon");
printf("\n\t\t#element symbol= Si");
printf("\n\t\t#semi metal in nature");
}
else if(atm==32)
{
printf("\n\t\t#element name= germanium");
printf("\n\t\t#element symbol= Ge");
printf("\n\t\t#semi metal in nature");
}
else if(atm==50)
{
printf("\n\t\t#element name= tin");
printf("\n\t\t#element symbol= Sn");
printf("\n\t\t#poor metal in nature");
}
else if(atm==82)
{
printf("\n\t\t#element name= lead");
printf("\n\t\t#element symbol= Pb");
printf("\n\t\t#poor metal in nature");
}
else
{
printf("\n\t\t#element not in this group");
}
goto y;
case 15:
if(atm==7)
{
printf("\n \t\t#element name= nitrogen");
printf("\n \t\t#element symbol=N");
printf("\n \t\t#non metal in nature");
}
else if(atm==33)
{
printf("\n\t\t#element name= arsenic");
printf("\n\t\t#element symbol= As");
printf("\n\t\t#metaloid in nature");
}
else if(atm==15)
{
printf("\n\t\t#element name= phosphorus");
printf("\n\t\t#element symbol= P");
printf("\n\t\t#non metal in nature");
}
else if(atm==51)
{
printf("\n\t\t#element name= Antimony");
printf("\n\t\t#element symbol= Sb");
printf("\n\t\t#metaloid in nature");
}
else if(atm==83)
{
printf("\n\t\t#element name= Bismuth");
printf("\n\t\t#element symbol= BI");
printf("\n\t\t#poor metal in nature");
}
else
{
printf("\n\t\t#element not in this group");
}
goto y;
case 16:
if(atm==8)
{
printf("\n\t\t#element name= Oxygen");
printf("\n\t\t#element symbol=O");
printf("\n\t\t#non metal in nature");
}
else if(atm==16)
{
printf("\n\t\t#element name= SULPHUR");
printf("\n\t\t#element symbol= S");
printf("\n\t\t#non metal in nature");
}
else if(atm==34)
{
printf("\n\t\t#element name= Selenium");
printf("\n\t\t#element symbol= Se");
printf("\n\t\t#non metal in nature");
}
else if(atm==52)
{
printf("\n\t\t#element name= tellunium");
printf("\n\t\t#element symbol= Te");
printf("\n\t\t3 metaloid in nature");
}
else if(atm==84)
{
printf("\n\t\t#element name= polonium");
printf("\n\t\t#element symbol= Po");
printf("\n\t\t#radioactive in nature");
}
else
{
printf("\n\t\t#element not in this group");
}
goto y;
case 17:
if(atm==9)
{
printf("\n\t\t#element name= flourine");
printf("\n\t\t#element symbol= F");
printf("\n\t\t#highly reactive in nature");
}
else if(atm==17)
{
printf("\n\t\t#element name= chlorine ");
printf("\n\t\t#element symbol= cl");
printf("\n\t\t#gas in nature");
}
else if(atm==35)
{
printf("\n\t\element name= bromine");
printf("\n element symbol= br");
printf("\n liquid in nature");
}
else if(atm==53)
{
printf("\n element name= iodine");
printf("\n element symbol= I");
printf("\n solid in nature");
}
else if(atm==85)
{
printf("\n element name= astatine");
printf("\n element symbol= AT");
printf("\n radioactive innature");
}
else
{
printf("\n not in this group ");
}
goto y;
case 18:
if(atm==2)
{
printf("\n element name= helium");
printf("\n element symbol= He");
printf("\n inert in nature");
}
else if(atm==10)
{
printf("\n element name= neon ");
printf("\n element symbol= Ne");
printf("\n inert in nature");
}
else if(atm==18)
{
printf("\n element name= argon");
printf("\n element symbol= Ar");
printf("\n inert in nature");
}
else if(atm==36)
{
printf("\n element name= krypton");
printf("\n element symbol= Kr");
printf("\n inert in nature");
}
else if(atm==54)
{
printf("\n element name= xenon");
printf("\n element symbol= Xe");
printf("\n inert innature");
}
else if(atm==86)
{
printf("\n element name= radon");
printf("\n element symbol= Rn");
printf("\n inert innature");
}
else
{
printf("\n not in this group ");
}
goto y;
default:
printf("\n\t\t\t wrong choice entered");
y: ;
printf("\n\n\tdo u want to continue....\n\n\ty-yes\n\n\tn->no\n\t\tenter (y or n):");
scanf("%s",&ch);
if(ch=='y')
goto z;
else
break;
}
getch();}}
Yumna Athif is offline   Reply With Quote

Reply

Tags
periodic table


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error in enabling the python wrapper Jinn SU2 Installation 2 April 23, 2022 13:52
Creating a new field from terms of the turbulence model HaZe OpenFOAM Programming & Development 15 November 24, 2014 13:51
Missing math.h header Travis FLUENT 4 January 15, 2009 11:48
Droplet Evaporation Christian Main CFD Forum 2 February 27, 2007 06:27
REAL GAS UDF brian FLUENT 6 September 11, 2006 08:23


All times are GMT -4. The time now is 11:11.