Jump to content



Photo
- - - - -

User Input In C


  • Please log in to reply
5 replies to this topic

#1 Naga

Naga

    Newbie

  • Members
  • Pip
  • 25 posts
  • Gender:Male
  • Location:chennai,India

  • Calculators:
    Casio 9860 GII

Posted 10 May 2012 - 03:12 PM

Hi,

Am trying to develop a mathematical program to calculate time when speed and distance are given.

How can I get user input ie, the distance and speed.

And then to calculate and display the results.

Please help.

#2 flyingfisch

flyingfisch

    Casio Maniac

  • Deputy
  • PipPipPipPipPipPipPipPip
  • 1891 posts
  • Gender:Male
  • Location:OH,USA
  • Interests:Aviation, Skiing, Programming, Mountain Biking.

  • Calculators:
    fx-9860GII
    fx-CG10 PRIZM

Posted 10 May 2012 - 03:40 PM

First of all, you will need revolutionFX. Secondly, you will need to put this at the top of your C program:

#include "fxlib.h"
#include "revolution.h"

fxlib.h and revolution.h should be in the same folder as your C program.


About the string input:

I got some information from this page


Prototype:
int string_input(int x, int y, char string[]);

Now, what you need to do is find out if the Casio SDK has atoi or an alternative. You are going to need to convert the string to ascii.

Your code will probably look like this:

//include the revolutionFX libs
#include "fxlib.h"
#include "revolution.h"

//Prototype the string_input function
int string_input(int x, int y, char string[]);

//Declare variables
char string_[];
int A;
int B;
int ans;


//main program
int main () {
   Bdisp_AllClr_VRAM();
   PrintXY (1, 1, "A:");						   //That's PrizmSDK code... I don't know what Casio FX SDK has.
   Bdisp_PutDisp_DD();
   string_input (4, 1, &string_);
   atoi (A, string);


   Bdisp_AllClr_VRAM();
   PrintXY (1, 1, "B:");
   Bdisp_PutDisp_DD();
   string_input (4, 1, &string_);
   atoi (B, string);
   

   Bdisp_AllClr_VRAM();   
   ans = a + b;
   PrintXY (1,1,ans);
   Bdisp_PutDisp_DD();
   //end program
   return 0
}




I did not test that code, but it should give you an idea. :)

#3 Forty-Two

Forty-Two

    Casio Overlord

  • Deputy
  • PipPipPipPipPipPipPip
  • 528 posts
  • Gender:Male
  • Location:Well, The sign says "You are here"...

  • Calculators:
    Casio fx-CG10 Prizm
    Casio fx-9860GII
    TI-84+ SE

Posted 10 May 2012 - 09:33 PM

Hi,

Am trying to develop a mathematical program to calculate time when speed and distance are given.

How can I get user input ie, the distance and speed.

And then to calculate and display the results.

Please help.


What model are you developing for? The instructions may vary, depending on the model, and your host OS.

#4 flyingfisch

flyingfisch

    Casio Maniac

  • Deputy
  • PipPipPipPipPipPipPipPip
  • 1891 posts
  • Gender:Male
  • Location:OH,USA
  • Interests:Aviation, Skiing, Programming, Mountain Biking.

  • Calculators:
    fx-9860GII
    fx-CG10 PRIZM

Posted 11 May 2012 - 12:20 AM

What model are you developing for? The instructions may vary, depending on the model, and your host OS.



He's using the fx-9860GII. ;)

#5 megabyting

megabyting

    Newbie

  • Members
  • Pip
  • 1 posts

  • Calculators:
    fx9860G

Posted 21 November 2012 - 12:30 AM

Hi there,
Is there any ready made C routine for casio SDK can be used to evaluate a formula in the string format, such as: (S^2+3)/((S^+1)*(S^2+10))?

Or is there any way to call the calculator's fn function?

Please help

#6 flyingfisch

flyingfisch

    Casio Maniac

  • Deputy
  • PipPipPipPipPipPipPipPip
  • 1891 posts
  • Gender:Male
  • Location:OH,USA
  • Interests:Aviation, Skiing, Programming, Mountain Biking.

  • Calculators:
    fx-9860GII
    fx-CG10 PRIZM

Posted 21 November 2012 - 12:34 AM

I think revolutionfx can handle that, but i'm not entirely sure.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users