Hello fellow chatters. Sorry to only come in when I need something. I am basically trying to create a c++ program where you put in a word. say you want to say an.
a=1
n=14
so then 15.
that is not the entire scope of the program but that is just what I am trying to start with. what I'm thinking now is something like
#include <iostream.h>
int main()
{
enum Alphabet {a=1, b=2...z=26};
}
and that is basically it. What I am seeing as the most trouble is assigning the finished value to each word. But any ideas would be appreciated!
also, no this program has very little practical value.
Hello fellow chatters. Sorry to only come in when I need something. I am basically trying to create a c++ program where you put in a word. say you want to say an.
a=1
n=14
so then 15.
that is not the entire scope of the program but that is just what I am trying to start with. what I'm thinking now is something like
#include <iostream.h>
int main()
{
enum Alphabet {a=1, b=2...z=26};
}
and that is basically it. What I am seeing as the most trouble is assigning the finished value to each word. But any ideas would be appreciated!
also, no this program has very little practical value.
er...wha?
You want to take a word as input, break it up, assign each letter a numerical value, add them all together and print the result? Is that right?
Proto on
and her knees up on the glove compartment
took out her barrettes and her hair spilled out like rootbeer
Hello fellow chatters. Sorry to only come in when I need something. I am basically trying to create a c++ program where you put in a word. say you want to say an.
a=1
n=14
so then 15.
that is not the entire scope of the program but that is just what I am trying to start with. what I'm thinking now is something like
#include <iostream.h>
int main()
{
enum Alphabet {a=1, b=2...z=26};
}
and that is basically it. What I am seeing as the most trouble is assigning the finished value to each word. But any ideas would be appreciated!
also, no this program has very little practical value.
er...wha?
You want to take a word as input, break it up, assign each letter a numerical value, add them all together and print the result? Is that right?
I could've made myself a sandwich right now and take a pic to post it, but would of taken too long and I'm lazy.
So now I'm picking at a chicken breast used for soup, while munching on bread, so close enough.
This thread makes me hungry but my stomach hurts. To satisfy my craving would be folly but oh god I desire sandwiches
Dont let ur stomach push u around, fight back and eat!
My stomach is a dick, srsly. One time I ate salad at my aunts wedding and I vomited all over my rented tux. The vomit was orange, and I was like "wtf?! I didn't eat anything organge?" True story.
Wash on
0
Options
SheriResident FlufferMy Living RoomRegistered Userregular
Hello fellow chatters. Sorry to only come in when I need something. I am basically trying to create a c++ program where you put in a word. say you want to say an.
a=1
n=14
so then 15.
that is not the entire scope of the program but that is just what I am trying to start with. what I'm thinking now is something like
#include <iostream.h>
int main()
{
enum Alphabet {a=1, b=2...z=26};
}
and that is basically it. What I am seeing as the most trouble is assigning the finished value to each word. But any ideas would be appreciated!
also, no this program has very little practical value.
er...wha?
You want to take a word as input, break it up, assign each letter a numerical value, add them all together and print the result? Is that right?
just about!
Have a sum variable, then for each character in the string add (stringName[n] - 'a') to it.
Smasher on
0
Options
SheriResident FlufferMy Living RoomRegistered Userregular
Me: Looks awesome.
Homeboy: Yeah.
Me: "Maxim gives it five stars." I don't know if I trust their opinion, though.
Homeboy: True.
Me: I heard good housekeeping only gave it 4 stars.
Homeboy: *lols*
Me: I wonder what cosmopolitan thinks. *lols*
Homeboy: I think I'll wait and see what Oprah says in her magazine.
Me: Or Watchtower.
Homeboy: "JESUS GIVES IT TWO THUMBS UP"
...So seriously. How is it?
Menthol on
You're not L33T enough for IDI/RN FTP!
0
Options
SheriResident FlufferMy Living RoomRegistered Userregular
Hello fellow chatters. Sorry to only come in when I need something. I am basically trying to create a c++ program where you put in a word. say you want to say an.
a=1
n=14
so then 15.
that is not the entire scope of the program but that is just what I am trying to start with. what I'm thinking now is something like
#include <iostream.h>
int main()
{
enum Alphabet {a=1, b=2...z=26};
}
and that is basically it. What I am seeing as the most trouble is assigning the finished value to each word. But any ideas would be appreciated!
also, no this program has very little practical value.
er...wha?
You want to take a word as input, break it up, assign each letter a numerical value, add them all together and print the result? Is that right?
just about!
Have a sum variable, then for each character in the string add (stringName[n] - 'a') to it.
yeah the more I think about this the more I realize it's a little out of my league. I haven't gone into strings yet. I'll skip ahead and see if I can hash it out.
Tarranon on
You could be anywhere
On the black screen
0
Options
SheriResident FlufferMy Living RoomRegistered Userregular
yeah the more I think about this the more I realize it's a little out of my league. I haven't gone into strings yet. I'll skip ahead and see if I can hash it out.
Which of the following have you learned about?
while loops
for loops
arrays
strings
It's curious that you know about enums before you've learned all the other stuff.
Tarranon-- it's actually a very, very common programming problem that they teach kids
but yeah, without knowledge of strings or arrays, you are pretty boned as far as elegant or brief code goes
i think the traditional most efficient solution is you input the word as a string, then there is some datapoint conversion that changes it to its unicode value
then you just subtract a constant to get each letter's actual value
other than that, you can just make an array with each letter's value and match each letter from the input string to it
it's a fundamental learning program because it teaches the use of the ++ function
EDIT: seriously though the first thing we learned was strings, hehe, you so crazy
Hello fellow chatters. Sorry to only come in when I need something. I am basically trying to create a c++ program where you put in a word. say you want to say an.
a=1
n=14
so then 15.
that is not the entire scope of the program but that is just what I am trying to start with. what I'm thinking now is something like
#include <iostream.h>
int main()
{
enum Alphabet {a=1, b=2...z=26};
}
and that is basically it. What I am seeing as the most trouble is assigning the finished value to each word. But any ideas would be appreciated!
also, no this program has very little practical value.
er...wha?
You want to take a word as input, break it up, assign each letter a numerical value, add them all together and print the result? Is that right?
just about!
Have a sum variable, then for each character in the string add (stringName[n] - 'a') to it.
yeah the more I think about this the more I realize it's a little out of my league. I haven't gone into strings yet. I'll skip ahead and see if I can hash it out.
basically, what smasher was doing there is accessing an individual character in the string. A string is essentially an array of characters (have you done arrays yet?)
so if you dump "Tarranon" into a string variable called strName, you can access individual characters in that string like so: strName[0] would be "T", strName[1] is "a", and so on.
so you could use a for loop to access each individual character in your string like so:
Tarranon-- it's actually a very, very common programming problem that they teach kids
but yeah, without knowledge of strings or arrays, you are pretty boned as far as elegant or brief code goes
i think the traditional most efficient solution is you input the word as a string, then there is some datapoint conversion that changes it to its unicode value
then you just subtract a constant to get each letter's actual value
other than that, you can just make an array with each letter's value and match each letter from the input string to it
it's a fundamental learning program because it teaches the use of the ++ function
EDIT: seriously though the first thing we learned was strings, hehe, you so crazy
Arrays and pointers are the biggest pieces of the puzzle as far as C++ goes.
Posts
took out her barrettes and her hair spilled out like rootbeer
Then I post a field of dancing vaginas and get jailed forever.
I need to reformat.
I need to save my music files.
Also, is this a good deal?
So now I'm picking at a chicken breast used for soup, while munching on bread, so close enough.
3DS: 2852-6809-9411
a=1
n=14
so then 15.
that is not the entire scope of the program but that is just what I am trying to start with. what I'm thinking now is something like
#include <iostream.h>
int main()
{
enum Alphabet {a=1, b=2...z=26};
}
and that is basically it. What I am seeing as the most trouble is assigning the finished value to each word. But any ideas would be appreciated!
also, no this program has very little practical value.
On the black screen
Dont let ur stomach push u around, fight back and eat!
3DS: 2852-6809-9411
er...wha?
You want to take a word as input, break it up, assign each letter a numerical value, add them all together and print the result? Is that right?
took out her barrettes and her hair spilled out like rootbeer
How is that even possible? That just means you don't like bread, since the only required element of a sandwich is two pieces of bread.
just about!
On the black screen
Sheri Baldwin Photography | Facebook | Twitter | Etsy Shop | BUY ME STUFF (updated for 2014!)
3DS: 2852-6809-9411
Have a sum variable, then for each character in the string add (stringName[n] - 'a') to it.
W-O-M-A-N(-w-i-c-h)
Sheri Baldwin Photography | Facebook | Twitter | Etsy Shop | BUY ME STUFF (updated for 2014!)
Man do I love bread. At work my lunch is always cheese buns, and if I have a good loaf of bread, thats my dinner.
3DS: 2852-6809-9411
::laugh track::
Me: Looks awesome.
Homeboy: Yeah.
Me: "Maxim gives it five stars." I don't know if I trust their opinion, though.
Homeboy: True.
Me: I heard good housekeeping only gave it 4 stars.
Homeboy: *lols*
Me: I wonder what cosmopolitan thinks. *lols*
Homeboy: I think I'll wait and see what Oprah says in her magazine.
Me: Or Watchtower.
Homeboy: "JESUS GIVES IT TWO THUMBS UP"
...So seriously. How is it?
You're not L33T enough for IDI/RN FTP!
I don't think you get it.
t Incen -
Sheri Baldwin Photography | Facebook | Twitter | Etsy Shop | BUY ME STUFF (updated for 2014!)
Sheri are you saying you taste like sloppy joes?
yeah the more I think about this the more I realize it's a little out of my league. I haven't gone into strings yet. I'll skip ahead and see if I can hash it out.
On the black screen
No, strawberries!
Wait, what?
Sheri Baldwin Photography | Facebook | Twitter | Etsy Shop | BUY ME STUFF (updated for 2014!)
Which of the following have you learned about?
while loops
for loops
arrays
strings
It's curious that you know about enums before you've learned all the other stuff.
A sandwich made of women and strawberries?
This I gotta try
but yeah, without knowledge of strings or arrays, you are pretty boned as far as elegant or brief code goes
i think the traditional most efficient solution is you input the word as a string, then there is some datapoint conversion that changes it to its unicode value
then you just subtract a constant to get each letter's actual value
other than that, you can just make an array with each letter's value and match each letter from the input string to it
it's a fundamental learning program because it teaches the use of the ++ function
EDIT: seriously though the first thing we learned was strings, hehe, you so crazy
I love bread!
Me, too!
Sheri Baldwin Photography | Facebook | Twitter | Etsy Shop | BUY ME STUFF (updated for 2014!)
Winter Wheat is cooked dough of the gods.
basically, what smasher was doing there is accessing an individual character in the string. A string is essentially an array of characters (have you done arrays yet?)
so if you dump "Tarranon" into a string variable called strName, you can access individual characters in that string like so: strName[0] would be "T", strName[1] is "a", and so on.
so you could use a for loop to access each individual character in your string like so:
for(i = 0; i < strName.length(); i++)
{
cout << strName;
}
took out her barrettes and her hair spilled out like rootbeer
Arrays and pointers are the biggest pieces of the puzzle as far as C++ goes.
3DS: 2852-6809-9411