Jump to content

Programming language to write app needed to keep data

Featured Replies

Can I write a app that keeps a certain value until it receives an input that increase or decrease it?

The trick is the input, not a program that has a variable. So you'll have to be a bit more specific there. Strictly speaking, your specification is fully satisfied with the following c++ code

#include <iostream>

int main() {
 for (int value(0); value!=-1; std::cin>>value)
   std::cout<<"value is now "<<value<<". Enter new value: ";
}

I somehow doubt it is what you were asking for, though.

  • Author

I require an app that keeps a value, but when i give it an input, say "A" it will decrease the value and give response "B". Can c++ be used to do that?

Any language can do this, really. You just need to learn the specifics on how to take input and how to increment or decrement. There isn't a reasonably mainstream language that can't do this (I suspect that there are some esoteric languages where this would be a challenge, there are some pretty weird languages out there). So, you have your choice of C, C++, C#, Visual Basic, Python, Ruby, Fortran, Java, etc. etc. etc.

 

The only question is whether this "value" needs to be persistent or not. I.e. if it needs to be stored somewhere while the program isn't running. If so, the value will need to be written and read from a file or otherwise "pickled". If it isn't one value, but a whole mess of them, I suggest a database of some sort.

Edited by Bignose

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.