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 8947859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:52:36+00:00 2026-06-15T12:52:36+00:00

I come today with general concern for my program. I’ve been putting a good

  • 0

I come today with general concern for my program. I’ve been putting a good amount of my time (time that I could use studying for finals) on this one program, and I feel like I need to step back from it for a bit. The program tells me these errors when I attempt to run it.

lines 115, 120, 131, 136, 146:
  warning: passing argument 1 of 'strcmp' makes pointer from integer without a cast
  note: expected 'const char *' but argument is of type 'int'

(note that this is a work in progress, and not really meant to be TOO functional, but if you see anything else, let me know)

My class has a very… interesting professor who teaches in a similarly interesting way, so I’ve had trouble attempting to understand some of the aspects of this programs requirements. Any help you can provide is greatly appreciated. Thanks in advance

#include<stdio.h>
#include<string.h>
#include<stdlib.h>

#define MAX_ITEMS 1000


struct drink {
int drinkNum;
double drinkPrice;
}drinklist[10];

struct items {
double itemPrice;
};

struct raffle {
double rafValue;
};

int main(){
double preTickets, doorTickets, minBid;
int preSold, numItems, rafTickets = 0, rafPrizes, rafCost;

int i, numEvents, x;

FILE* fin;
fin = fopen("input.txt", "r");

// Line#1 from input file
fscanf(fin, "%lf %lf %d", &preTickets, &doorTickets, &preSold);

// Line#2 from input file
fscanf(fin, "%d %lf", &numItems, &minBid);

// This allocates space for the list of auction items dynamically. 

struct items* itemList = (struct items*)malloc(sizeof(struct items)*numItems);

// Line#3 from input file.
for(i = 0; i < numItems; i++){
    fscanf(fin, "%lf", &itemList[i].itemPrice);
}

// Line#4 fron input file.
fscanf(fin, "%d %d %d", &rafTickets, &rafCost, &rafPrizes);

// Same as the itemList. Creates enough space for the number of raffle prizes you need.
struct raffle* raffleList = (struct raffle*)malloc(sizeof(struct raffle)*rafPrizes);


// Line#5 from input file
for(i = 0; i < rafPrizes; i++){
    fscanf(fin, "%lf", &raffleList[i].rafValue);
}

struct drink drinklist[10];

// Line#6 from input file
for(i = 0; i < 10; i++){
    fscanf(fin, "%d", &drinklist[i].drinkNum);
}

 // Line#7 from input file
for(i = 0; i < 10; i++){
    fscanf(fin, "%lf", &drinklist[i].drinkPrice);
}

// This just prints out the output that has been read in so far.
// This will also show you how you can refer to the different members of data that you need later.
printf("%.2lf %.2lf %d\n", preTickets, doorTickets, preSold);
printf("%d %.2lf\n", numItems, minBid);

for(i = 0; i < numItems; i++){
    printf("%.2lf ", itemList[i].itemPrice);
}

printf("\n%d %d %d\n", rafTickets, rafCost, rafPrizes);

for(i = 0; i < rafPrizes; i++){
    printf("%.2lf ", raffleList[i].rafValue);
}

printf("\n");
for(i = 0; i < 10; i++){
    printf("%d ", drinklist[i].drinkNum);
}
printf("\n");
for(i = 0; i < 10; i++){
    printf("%.2lf ", drinklist[i].drinkPrice);
}
printf("\n");

// This frees the memory that you allocated dynamically.
free(itemList);
free(raffleList);


// loop that runs from from 0 to < numCommands and read in each command and evaluate it.

fscanf(fin, "%d", &numEvents);
fclose(fin);

int actLoop, boughtTickets, boughtRaffle, boughtDrink;
int itemPrice, currentBid, guestBid, bidOffer;
int guestRaf;
int drinkWanted;

for (actLoop=0; actLoop<numEvents; actLoop++); {

int action;

fscanf(fin, "%s", action);

if (strcmp(action, "BUY TICKET") == 0) {
    fscanf(fin, "%d", boughtTickets);
    printf("Sold tickets %d - %d", &preSold+1, &preSold+boughtTickets);
}

else if (strcmp(action, "BIDITEM") == 0) {
    fscanf(fin, "%d%d%.2lf", &itemList[i], &guestBid, &bidOffer);

    if (bidOffer < itemList[i].itemPrice + minBid) {
        printf("Bid for item %d rejected for person %d at %.2lf", &itemList[i], &guestBid, &bidOffer);
    }
    else
        printf("Bid for item %d accepted for person %d at %.2lf", &itemList[i], &guestBid, &bidOffer);
        itemList[i].itemPrice == bidOffer;
}

else if (strcmp(action, "CLOSEAUCTION") == 0) {

}


else if (strcmp(action, "BUY RAFFLE") == 0) {
    fscanf(fin, "%d%d", &boughtRaffle, &guestRaf);
    if (boughtRaffle > rafTickets) {
        boughtRaffle == rafTickets;
        rafTickets = rafTickets - boughtRaffle;
    }
        printf("Raffle Tickets %d - %d given to person %d", &rafTickets, &rafTickets+boughtRaffle, &guestBid);

}

else if (strcmp(action, "BUY DRINK") == 0) {
    fscanf(fin, "%d%d", &drinkWanted, &drinklist[i].drinkNum);
    if (drinklist[i].drinkNum < drinkWanted) {
        drinkWanted = drinklist[i].drinkNum - drinkWanted;
    }
    printf("Sold %d of drink %d", &drinklist[i].drinkNum, &drinkWanted);
        drinklist[i].drinkNum = drinklist[i].drinkNum - drinkWanted;

}
}
}
  • 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-15T12:52:40+00:00Added an answer on June 15, 2026 at 12:52 pm

    You’re reading a string into an int, you should use char array instead:

    char action[200];
    fscanf(fin, "%199s", action);
    

    And here you need the address of boughtTickets

    fscanf(fin, "%d", &boughtTickets);
    

    Here you’re printing the addresses of variables instead of their values:

    printf("Sold tickets %d - %d", &preSold+1, &preSold+boughtTickets);
    

    You get the idea, please read a good C book I recommend K&R.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today I decided to come up with a program that would be useful for
One of our clients has come back to us today with a bug that
I started learning Dart today, and I've come across something that my google skills
I need to come up with a program that generates an xml file like
Today I come across a Function that makes me really wondering. So lets assume
I've come across the notion of 'Proxy Pattern' today on jQuery.com, but could not
Today I was reading Trek's tutorial for the fourth time, hoping that I would
Today I found out that putting strings in a resource file will cause them
I'm a beginner in wpf, today I come across an odd issue that the
Today, reading Servlet 3.0 specification, I've come across a sentence: We emphasize that this

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.