|
-
C
Date: 03/28/08
(Algorithms) Keywords: programming, html, java
I'm finding C difficult to understand. I'm working using two books: C in a Nutshell and I'm referencing with Comprehensive C (which is old but it was free.) The problem I'm trying to solve is to create a Reverse Polish Notation calculator. I'm using an array as a stack and the basic principle is: for input (from command prompt) 2 1 + Push 2 on the stack. Push 1 onto the stack. Meet operator, pop two and then push answer onto the stack.
But I'm having problems with my main method, particularly with the C syntax. This is my main method so far:
/* * I need a way for the program to read input separated by space, where a space will * indicate the end of a value. For example: 23 3 is the input twenty three and three, * not: two, three, three. * * When an integer operand is encountered, it will be pushed onto the stack. An operator * will cause two items of the stack of be popped then a push of the answer. argc = SIZE OF THE ARRAY argv = Array of strings that represents the command line entered. */
int main (int argc, char *argv)
{ int i; for (i = 1; i < argc; i++) { if (x argv = int) { push(int x)
//http://www.cppreference.com/stdstring/isdigit.html //http://www.cppreference.com/stdstring/atoi.html } }
The hyperlinks are a link to two methods from the library that I need to use: isdigit() and atoi(). Because the input is being entered from the command prompt it's my understanding that a character and an integer cannot be differentiated simply by their bit pattern. What I need to do with the input is take the "string", convert it to an integer and then check to see if it is an integer or not.
Now, in Java I'd do something like x.isdigit().atoi() but... gah! There's a lot of true/false requirements in there and I don't think I actually fully understand exactly what I'm trying to do.
This is what I'm planning to do, in English:
If ( x is a character) { either return 0 as value or set next item to memory location [x] } if (x is an operator) { POP two from the stack use operator on two operands Push answer onto the stack again //error checking for condition that only one value has been pushed onto stack } //otherwise, fall through assuming that x is an integer convert x into an integer using atoi() Push (x)
TADA!
I'm planning on using if for error checking and converting everything else to case statements instead. I'm use to programming in java, though, so I'm scared that I'm java-ing too much :/
Advice? Kicks? Clarifications?
Source: https://algorithms.livejournal.com/98390.html
-
C
Date: 02/01/08
(Algorithms) Keywords: programming, java
Can anyone recommend a good beginners book on C?
In a few weeks time I will be using C for low level programming to solve problems. (Low level programming being the class.) C will be my second language, I already understand the basics of java objects and ADT's so preferably a book that defines clearly why C isn't object oriented...
Edit: I ended up buying "C in a Nutshell" because it is the course textbook and came highly recommended. It doesn't provide enough baby-step explanations for me, though, so I'm still finding C a damned difficult language to learn. Thank you all for your suggestions, I'm planning on buying the recommended book anyway in the hope that the developers of C will be better at explaining things.
Source: https://algorithms.livejournal.com/97535.html
-
ComboBoxes in two pages.
Date: 03/12/08
(Asp Dot Net) Keywords: programming, asp, web
Hi. I'm newbie both in ASP.NET and in web programming, so my question may be dumb. Sorry if so. I have two pages in my project and each page contains combo box. Comboboxes bind to one data source. I need to solve following task: if user select combo box item in one page, the same item must be selected in another page automatically. Is there any ways to do this or it's impossible?
Source: https://aspdotnet.livejournal.com/97019.html
-
microXMPP project
Date: 05/10/09
(See my site) Keywords: programming, web, linux
I started a new project, microXMPP. It's a lightweight implementation of Jabber/XMPP protocol, written in ANSI C. The idea is to make XMPP protocol support applications, not applications support the protocol. Because of this, microXMPP is made as easy to use as possible, and as compatible as it could be. The code can be compiled under both Windows and Linux, and callback-based architecture avoids complex programming. Great for making XMPP bots and other Jabber client stuff!
The microXMPP project web page is http://xmppmicro.110mb.com/. All the sources can be downloaded from that page, along with documentation. In order to make things easier, a minimalist Jabber client is provided as application example. Small updates appear almost every week.
Source: https://see-my-site.livejournal.com/119635.html
-
Social website Idea
Date: 06/25/08
(See my site) Keywords: programming, web
Inspiration: Everywhere I go I see posted signs advertising www.yourcityheresingles.com. It seems like no matter how remote your location or how minimal your local population, there now exist websites devoted to finding singles in your area. As someone who hasn't had so much experience being single, but LOTS of experience being "lonely" and seemingly "friendless" amongst a HUGE population of people my age, I feel that a website for networking is long overdue. Sure we may live in large cities but rarely do we venture outside our circles when we go out. If you're in a relationship, bar outings typically involve you, your significant other, and either your own or your significant other's friends and their partners. Rarely do we involve ourselves with new faces outside of work or school and even if we want to, rarely do we introduce ourselves to new strangers when faced with the comforting presence of our current friends. As a former member of various sub-cultures including punks and ravers, this "random" meeting of new people with similar interests is an almost guaranteed outcome of attending the various musical events associated with your "scene." I definitely took this for granted in college, meeting 2-a dozen new faces each evening without even trying. If you've been involved in a sub-culture you understand. Simply asking to bum a cigarette or paying someone a compliment on their wardrobe or dance technique is an easy enough way to find a new friend. Then I entered the "real world," full of business types and outgoing yet reserved people, social enough to find themselves in a bar trivia night yet frightened/uninterested enough to avoid social contacts beyond the group they arrived with. Unfortunately I place myself in this category as well; it's not that I don't want to meet new people but when you're already with 10 other people it just seems misplaced and sometimes desperate to strike up conversation with an unknown neighbor. And yet I'm willing to bet there are many like me who have friends and a relationship, and are relatively happy with their life....but still long for others out there with MORE similar interests, or at least a change of the rehearsed, overplayed interactions we're accustomed to. So, my idea is simply to build a site with a basic profile, available for free, to people living in the same zipcode, who aren't looking for anything more than a friend with similar interests. If you're interested and have programming knowledge, please reply so we can get something started.
Source: https://see-my-site.livejournal.com/115843.html
|