Re: 2 Questions for C, one is how to get VIM working, and I keep getting unexpected token!

  • From: Paulo Panhoto < >
  • To:
  • Subject: Re: 2 Questions for C, one is how to get VIM working, and I keep getting unexpected token!
  • Date: Tue, 9 Apr 2013 17:07:03 -0300

Hello,

Here are my answers:

First question: You're missing a semi-colon before the if statement.
A hint: the program won't print the correct value if you use &fGallons with printf (remove the &).
Next question: why would you want to use vim when you already have a text editor -- CB or NB ?

Regards,

Paulo


On Tue, Apr 9, 2013 at 4:11 PM, Flof < " target="_blank"> > wrote:
#include <stdio.h>
#include <stdlib.h>

/*
 *
 */
int main(void)
{
    float fGallons;
    float fMiles;
    float fAverage;
    float tAverage;

    printf("Enter the gallons used (-1 to end):  ");
    scanf("%f", &fGallons)
    if(fGallons != -1){
        printf("%f  \n", &fGallons);
    }
    else{
        printf("\n Thanks for using our program  \n");
    }
    return 0;
}


I pretty much have errors from my first if statement down.(unexpected token), does not read any of my if or else statements, but printf and scanf work.  I am just learning programming, I do have cygwin setup for GCC as my c compiler.

My next question, I recently switched from code::blocks to netbeans so I could use VIM.  I have downloaded the program but can not get it working!  Thanks in advance!







2 Questions for C, one is how to get VIM working, and I keep getting unexpected token!

Flof 04/09/2013

Re: 2 Questions for C, one is how to get VIM working, and I keep getting unexpected token!

Paulo Panhoto 04/09/2013

Re: 2 Questions for C, one is how to get VIM working, and I keep getting unexpected token!

Ivan Soleimanipour 04/09/2013

Project Features

About this Project

CND was started in November 2009, is owned by DimaZh, and has 131 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close