Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7793631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:32:56+00:00 2026-06-01T22:32:56+00:00

Am getting this error message for the following code, but it doesn’t make sense

  • 0

Am getting this error message for the following code, but it doesn’t make sense at all. Can you please check this code and tell what’s wrong? Have commented the code on the relevant line.

#import <Foundation/Foundation.h>

typedef struct {
    float exchangeRate;
    double budget;
    double euroTransaction;
} budget;

int main(int argc, const char * argv[])
{
    budget vacationBudget;

    void spendDollars (double dollars) {  //Expected ';' at end of declaration
        vacationBudget.budget -= 100;
    }

    void chargeEuros(double euros) {
        vacationBudget.euroTransaction = euros*vacationBudget.exchangeRate;
        vacationBudget.budget -= vacationBudget.euroTransaction;
    }

    vacationBudget.exchangeRate = 1.2500;
    vacationBudget.budget = 1000.00;
    double numberDollars = 100;
    double numberEuros = 100;

    spendDollars(numberDollars);
    NSLog(@"Converting %.2f US dollars into euros leaves $%.2f", numberDollars, vacationBudget.budget);



    NSLog(@"Charging %.2f euros leaves $%.2f", numberEuros, vacationBudget.budget);

    return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T22:32:58+00:00Added an answer on June 1, 2026 at 10:32 pm

    Funcitions can’t be inside main. Change to:

    #import <Foundation/Foundation.h>
    
        typedef struct {
            float exchangeRate;
            double budget;
            double euroTransaction;
        } budget;
    
    budget vacationBudget;
    
    void spendDollars (double dollars) {  //Expected ';' at end of declaration
                vacationBudget.budget -= 100;
        }
    
        void chargeEuros(double euros) {
                vacationBudget.euroTransaction = euros*vacationBudget.exchangeRate;
                vacationBudget.budget -= vacationBudget.euroTransaction;
        }
    
        int main(int argc, const char * argv[])
        {
    
            vacationBudget.exchangeRate = 1.2500;
            vacationBudget.budget = 1000.00;
            double numberDollars = 100;
            double numberEuros = 100;
    
            spendDollars(numberDollars);
            NSLog(@"Converting %.2f US dollars into euros leaves $%.2f", numberDollars, vacationBudget.budget);
    
    
    
            NSLog(@"Charging %.2f euros leaves $%.2f", numberEuros, vacationBudget.budget);
    
            return 0;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting this error message with the code below: class Money { public: Money(float
I'm getting this error message whiile running a Webservice I'm working on. it builds,
This is the actual error message i'm getting if i run it on an
A buddy of mine has been getting this error mesage when trying to run
My custom error messages quit working somewhere along the way and I'm getting this
Getting this error: 2009-09-03 12:44:02.307 xcodebuild[307:10b] warning: compiler 'com.apple.compilers.llvm.clang.1_0.analyzer' is based on missing compiler
Getting this error with jquery & jquery.form. Site has been live for awhile..upgraded to
Getting this error when try to add an item to my repositories/context: Collection has
I´m getting this error while trying to commit to a svn repository: svn: MKACTIVITY
Keep getting this error after inserting a subdatasheet into a query and trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.