C++ Programming help - Home Brew Forums

Register Now!
Home Brew Forums > Home Brewing Community > General Chit Chat > C++ Programming help

Reply
 
Thread Tools
Old 07-23-2008, 03:22 AM   #1
SporkD2
 
SporkD2's Avatar
Recipes 
 
Jun 2008
San Antonio, Texas
Posts: 740
Liked 1 Times on 1 Posts



Anyone on this board a good c++ programmer? I am currently a computer sci major and programming is hard for me to understand. I would love to have someone who I could email questions and maybe have a few chats about things that are confusing me.

Thanks

Please contact me via aim, yahoo messenger or [email protected]

 
Reply With Quote
Old 07-23-2008, 03:44 AM   #2
Yuri_Rage
Gritty.
HBT_MODERATOR.png
 
Yuri_Rage's Avatar
Recipes 
 
Jul 2006
Southwest
Posts: 14,289
Liked 808 Times on 512 Posts


For your sake, I hope that your major is focused in areas other than programming (hardware, architecture, etc). My degree is in computer science, and we really focused on code/software development. C++ is a pretty simple language. What's confusing?
__________________
Homebrewed Blog..........YouTube Channel .......... Shirts, posters, etc

 
Reply With Quote
Old 07-23-2008, 03:47 AM   #3
CodeRage
Death by Magumba!
HBT_LIFETIMESUPPORTER.png
 
CodeRage's Avatar
Recipes 
 
Aug 2007
Melbourne, Fl
Posts: 2,222
Liked 47 Times on 20 Posts


You can pick my brain too.
One of the best books I have is Jamsas C/C++ programming bible. Highly recomend it.
__________________
Brutus 20e build | Electrical Primer for Brewers | Auber SYL-2362A2 PID Install & Config
So as I am walking out the door this morning I think to my self:
"self, going to work on Monday is like knowing you're going to get kicked in the nuts. You just don't know when or by who"

 
Reply With Quote
Old 07-23-2008, 03:56 AM   #4
SporkD2
 
SporkD2's Avatar
Recipes 
 
Jun 2008
San Antonio, Texas
Posts: 740
Liked 1 Times on 1 Posts


Well my emphasis is computer networking, not programming. I have already taken the intro course and am now into the 2nd out of 3 c++ classes. Just looking for someone to answer some simple questions about the programs I have to write for when I get stuck.

For example:

I have to take a user inputted string, such as AAA765, make sure that the first three characters are uppercase (toupper) and then do a binary search from an array I have created and show a fine amount. I can do this if the user enters their license plate number as an uppercase, but if they enter lowercase, it comes back as not found.

 
Reply With Quote
Old 07-23-2008, 04:00 AM   #5
Yuri_Rage
Gritty.
HBT_MODERATOR.png
 
Yuri_Rage's Avatar
Recipes 
 
Jul 2006
Southwest
Posts: 14,289
Liked 808 Times on 512 Posts


Ok, that sounds pretty straightforward, but some example code would make it far easier to troubleshoot.
__________________
Homebrewed Blog..........YouTube Channel .......... Shirts, posters, etc

 
Reply With Quote
Old 07-23-2008, 04:00 AM   #6
CodeRage
Death by Magumba!
HBT_LIFETIMESUPPORTER.png
 
CodeRage's Avatar
Recipes 
 
Aug 2007
Melbourne, Fl
Posts: 2,222
Liked 47 Times on 20 Posts


Can you post your code?
__________________
Brutus 20e build | Electrical Primer for Brewers | Auber SYL-2362A2 PID Install & Config
So as I am walking out the door this morning I think to my self:
"self, going to work on Monday is like knowing you're going to get kicked in the nuts. You just don't know when or by who"

 
Reply With Quote
Old 07-23-2008, 04:12 AM   #7
CodeRage
Death by Magumba!
HBT_LIFETIMESUPPORTER.png
 
CodeRage's Avatar
Recipes 
 
Aug 2007
Melbourne, Fl
Posts: 2,222
Liked 47 Times on 20 Posts


Well to address the lower case issue.
I am using lplate as the input string
You can do something like
Code:
char *str=&lpate;
for (int i=0 : i<strlen(str) : i++)
{
  if (islower(*(str+i)))
    toupper(*(str+i));
}
Now this is C, not C++. If you're expected to use some Class and it's methods to do this we need to know what object you are using. Or are you building the clasS?

Edit: fixed syntax
__________________
Brutus 20e build | Electrical Primer for Brewers | Auber SYL-2362A2 PID Install & Config
So as I am walking out the door this morning I think to my self:
"self, going to work on Monday is like knowing you're going to get kicked in the nuts. You just don't know when or by who"

 
Reply With Quote
Old 07-23-2008, 04:34 AM   #8
Yuri_Rage
Gritty.
HBT_MODERATOR.png
 
Yuri_Rage's Avatar
Recipes 
 
Jul 2006
Southwest
Posts: 14,289
Liked 808 Times on 512 Posts


Maybe this will help:
Code:
#include <iostream>
#include <ctype.h>
#include <string>

using namespace std;

void makeupper (string& s)
{
  int i = 0;
  while (s[i])
  {
    s[i] = (toupper(s[i]));
    i++;
  }
}

int main ()
{
  int i = 0;
  string str = "It's 5 o'clock somewhere!\n";
  makeupper(str);
  cout << str;
  return 0;
}
EDIT: Damn, Virtuous beat me to it. I like mine better.
__________________
Homebrewed Blog..........YouTube Channel .......... Shirts, posters, etc

 
Reply With Quote
Old 07-23-2008, 04:39 AM   #9
CodeRage
Death by Magumba!
HBT_LIFETIMESUPPORTER.png
 
CodeRage's Avatar
Recipes 
 
Aug 2007
Melbourne, Fl
Posts: 2,222
Liked 47 Times on 20 Posts


Quote:
Originally Posted by Yuri_Rage View Post
Maybe this will help:
Code:
#include <iostream>
#include <string>

using namespace std;

void makeupper (string& s)
{
  int i = 0;
  while (s[i])
  {
    s[i] = (toupper(s[i]));
    i++;
  }
}

int main ()
{
  int i = 0;
  string str = "It's 5 o'clock somewhere!\n";
  makeupper(str);
  cout << str;
  return 0;
}
EDIT: Damn, Virtuous beat me to it. I like mine better.

You need ctype.h in there too. Cant make it too easy for him though That and I dont remember if toupper() checks if a char is a lower case alpha. Probably does
__________________
Brutus 20e build | Electrical Primer for Brewers | Auber SYL-2362A2 PID Install & Config
So as I am walking out the door this morning I think to my self:
"self, going to work on Monday is like knowing you're going to get kicked in the nuts. You just don't know when or by who"

 
Reply With Quote
Old 07-23-2008, 04:40 AM   #10
Yuri_Rage
Gritty.
HBT_MODERATOR.png
 
Yuri_Rage's Avatar
Recipes 
 
Jul 2006
Southwest
Posts: 14,289
Liked 808 Times on 512 Posts


Quote:
Originally Posted by Virtuous View Post
You need ctype.h in there too.
Compiles and runs just fine.

...but it probably shouldn't. toupper() is supposed to be in ctype.h.
__________________
Homebrewed Blog..........YouTube Channel .......... Shirts, posters, etc

 
Reply With Quote
Reply
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with Love TS programming GamePreserve Kegerators & Keezers 17 12-24-2009 06:00 PM
Help Programming PID Please kickflip_mj Equipment/Sanitation 5 08-13-2009 03:21 PM
Need some help programming this thing... Sherpa FE Equipment/Sanitation 10 02-10-2009 12:21 AM
My geek programming skills may be useful! pompeiisneaks Brewing Software 19 02-09-2009 07:32 PM
Computer Programming brauhaus General Chit Chat 21 08-06-2008 07:00 PM


Forum Jump