473,320 Members | 2,073 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,320 software developers and data experts.

why i got type mismatch in re redeclaration of function ComputeMeters ?

1
Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. int computeFeet(int yard);
  3. int computeInches(int yard);
  4. float computeMeters(int yard);
  5. main()
  6. {
  7. int yard ,f,i;
  8. float m ;
  9. clrscr();
  10. printf("Input value of yard :"); scanf("%d",&yard);
  11.  
  12. f=computeFeet(yard);
  13. i=computeInches(yard);
  14. m=computeMeters(yard);
  15.  
  16. printf("\n\nEquivalent values in :\nFeet :%d\nInches: %d\nMeters: %.2f",f,i,m);
  17.  
  18. getch();
  19. }
  20.  
  21.  computeFeet(int yard)
  22. {
  23. int feet;
  24.  
  25. feet=yard*3;
  26. return feet;
  27. }
  28.  
  29.  computeInches(int yard)
  30. {
  31. int inches;
  32.  
  33. inches=yard*36;
  34. return inches;
  35. }
  36.  
  37.  computeMeters(int yard)
  38. {
  39.  
  40. float meters;
  41.  
  42. meters=yard*0.9144;
  43.  
  44. return meters;
  45. }
Oct 28 '13 #1
2 2237
stdq
94 64KB
Hi! Your function prototypes specify the return types, but this information must also be present in the function definitions. For example, line 37 should be

Expand|Select|Wrap|Line Numbers
  1. float computeMeters(int yard)
Oct 28 '13 #2
weaknessforcats
9,208 Expert Mod 8TB
Your function prototype shows ComputeMeters to return a float but where the function is defined there is no return type. That would mean default-int which is not supported by C++.

Just add float as the return in the function definition and you are good to go.
Oct 28 '13 #3

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

Similar topics

4
by: Laura | last post by:
Help. Below is my code. Getting Type mismatch error on the noted line. I'm trying to send an array (aryNewD) with 4 columns and x rows to a function to save all the array info into a SQL Server...
3
by: amitbadgi | last post by:
I am getting teh following error while converting an asp application to asp.net, Exception Details: System.Runtime.InteropServices.COMException: Type mismatch. Source Error: Line...
6
by: shan | last post by:
What is the meaning for the error expression syntax and type mismatch error.I am using turbo c++.can anybody correct the errors in the folowing program. Following program is to find matrix...
3
by: jg | last post by:
in VB 2005 the class myClass, I have Dim someStringArrary() As String --- sub New() MyBase.New() ... 'values assigned to elements of someStringArrary End Sub ......
3
by: cyberdwarf | last post by:
Hi Any idea why the following (cut down) function gives a "Type Mismatch" error? I've tried almost everything, in terms of arrays, etc, but I need to pass back 3 values (int, int, double)...
2
by: psychomad | last post by:
Please, can someone help me out to solve this error, i've been searching throughout my codes and yet i didnt succeed in finding the error!!!! The Error is: Server Error in '/' Application....
19
by: Lysander | last post by:
I have written a query that takes three integers representing day,month and year, forms a date from them and compares this date to the date the record was entered and returns any records where the...
1
by: eros | last post by:
CREATE OR REPLACE FUNCTION f_customerlogininfo(varchar, varchar, varchar) RETURNS public.v_customerlogininfo AS ' DECLARE p_schm ALIAS FOR $1; p_contact ALIAS FOR $2; p_status ALIAS...
2
by: hype261 | last post by:
So I have a SQL Query I am trying to author and it keeps giving me a Data Type mismatch error which I can't seem to see. Exact error message is Data type mismatch in criteria expression. Here is...
7
by: tan007 | last post by:
#include<stdio.h> int remove(char s); int getline(char line,int len); main() { int len; len=0; char line; while(getline(line,len)>0)
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.