Forum: C Apr 1st, 2007 |
| Replies: 1 Views: 1,844 Last quarter our last assignment was to create two programs that gernerate silly sentences from words contained in a file.
I was able to create the program with a map, but have no idea how to do... |
Forum: C Feb 28th, 2007 |
| Replies: 3 Views: 4,206 Yeah...like that.
I actually saw that in my research, but didn't think I could convert it to what I needed.
Your suggestion prompted me to look at the code a little closer, and I came up with... |
Forum: C Feb 27th, 2007 |
| Replies: 3 Views: 4,206 I am trying to learn how to write a merge sort function, but I have only gotten so far with the book I am using now:
template <class T>
void mergeSort(vector<T>& s) { mergeHelper(s.begin(), 0,... |
Forum: C Sep 20th, 2006 |
| Replies: 11 Views: 6,635 Could he use something like
static_cast<int>(string[0]) - 48 |
Forum: C Sep 20th, 2006 |
| Replies: 11 Views: 6,635 Correct me if I'm wrong...but doesn't atoi() require a C-String as the argument?
char input[20];
code...code...code...
atoi(input); |
Forum: C Sep 18th, 2006 |
| Replies: 4 Views: 2,016 If you must use a double...for whatever reason...you can use
if (loanYears - static_cast<int>(loanYears) != 0) |
Forum: C Sep 17th, 2006 |
| Replies: 6 Views: 967 You understood that, Salem? |
Forum: C Aug 20th, 2006 |
| Replies: 25 Views: 32,325 I wasn't responding to DMR, I was responding to Salem.
DMR snuck that in while I was typing...lol. |
Forum: C Aug 20th, 2006 |
| Replies: 25 Views: 32,325 I didn't resurrect it...I just answered t. Don't shoot the messenger.
If you have a better solution, share it. |
Forum: C Aug 20th, 2006 |
| Replies: 25 Views: 32,325 /* atoi example */
#include <stdio.h>
#include <stdlib.h>
int main ()
{
int i;
char szInput [256];
printf ("Enter a number: ");
gets ( szInput ); |
Forum: C Aug 20th, 2006 |
| Replies: 5 Views: 1,037 Right off the bat I see 2 things...
if(c=getchar())!='\n')
should be
c == getchar(); |
Forum: C Aug 20th, 2006 |
| Replies: 25 Views: 32,325 Convert the string to a character array and then use atoi |