CWSGuy406 Posted October 5, 2004 Share Posted October 5, 2004 I need a lot of help with this. I need to write a program in C++ that calculates stocks and places them into a table-like format. Can someone help me out? And, perhaps teach me a little bit of it too? I would really appreciate, I've only missed one class this year, and I'm totally lost. I have no clue what the hell we're doing... Anyways, here's the program I need to write... (Alignment may be off.) "Create a program that lists a stock portfolio from the prior day. Have the user input his or her name, today's date, and information about 3 stocks (stock name, its opening value for yesterday, its closing value for yesterday, and the amount of shares owned). Use decimals and integer. Create a table of information as output. The table should look as follows: D A's Portfolio 1/28/03 (previous day) Stock Name Opening Value Closing Value Shares Amount Gained/Lost Toys R Us 15 18 100 +300 Microsoft 26 25.5 50 -25 Mobil 27 31 200 +475 Totals We've been using strcpy's, strcat's, chars, ints, floats, cin's, cout's, and I have absolutely no f***ing clue what any of it means. And I can't take the class Pass/Fail, so - because I have a C in the class, it means my class rank of 26th is going to drop, and I'm so f***ing pissed. I need to understand this s*** ASAP... Quote Link to comment Share on other sites More sharing options...
SnB Posted October 5, 2004 Share Posted October 5, 2004 I've taken 2 years of C++, i can help you out...big time, IM me. Quote Link to comment Share on other sites More sharing options...
SoxFanForever Posted October 5, 2004 Share Posted October 5, 2004 My favorite coding joke was always dim sum = i like....anyone? Anyone? Quote Link to comment Share on other sites More sharing options...
SnB Posted October 5, 2004 Share Posted October 5, 2004 Here's a barebones program, the table won't work because i can't remember how to space correctly....and you might need to make some changes to the variable types (don't know if string will work w/ your compiler) but this should give yo uan idea. String username; String date; Double Stock1name; Double Stock1open; Double Stock1close; Double Stock1shares; Double Stock2name; Double Stock2open; Double Stock2close; Double Stock2shares; Double Stock3name; Double Stock3open; Double Stock3close; Double Stock3shares; int main() { cout cin>>username; cout cin>>date; cout cin>>stock1name; cout cin>>stock1open; cout cin>>stock1close; cout cin>>stock1shares; cout cin>>stock2name; cout cin>>stock2open; cout cin>>stock2close; cout cin>>stock2shares; cout cin>>stock3name; cout cin>>stock3open; cout cin>>stock3close; cout cin>>stock3shares; cout cout cout cout return 0; } Quote Link to comment Share on other sites More sharing options...
Rowand44 Posted October 5, 2004 Share Posted October 5, 2004 Here's a barebones program, the table won't work because i can't remember how to space correctly....and you might need to make some changes to the variable types (don't know if string will work w/ your compiler) but this should give yo uan idea. String username; String date; Double Stock1name; Double Stock1open; Double Stock1close; Double Stock1shares; Double Stock2name; Double Stock2open; Double Stock2close; Double Stock2shares; Double Stock3name; Double Stock3open; Double Stock3close; Double Stock3shares; int main() { cout cin>>username; cout cin>>date; cout cin>>stock1name; cout cin>>stock1open; cout cin>>stock1close; cout cin>>stock1shares; cout cin>>stock2name; cout cin>>stock2open; cout cin>>stock2close; cout cin>>stock2shares; cout cin>>stock3name; cout cin>>stock3open; cout cin>>stock3close; cout cin>>stock3shares; cout cout cout cout return 0; } Quote Link to comment Share on other sites More sharing options...
da_bears86 Posted October 5, 2004 Share Posted October 5, 2004 Here's a barebones program, the table won't work because i can't remember how to space correctly....and you might need to make some changes to the variable types (don't know if string will work w/ your compiler) but this should give yo uan idea. String username; String date; Double Stock1name; Double Stock1open; Double Stock1close; Double Stock1shares; Double Stock2name; Double Stock2open; Double Stock2close; Double Stock2shares; Double Stock3name; Double Stock3open; Double Stock3close; Double Stock3shares; int main() { cout<<"What is your name?<<endl; cin>>username; cout<<"What is today's date?"<<endl; cin>>date; cout<<"Stock 1: Name?"<<endl; cin>>stock1name; cout<<"Stock 1: Opening Value?"<<endl; cin>>stock1open; cout<<"Stock 1: Closing Value?"<<endl; cin>>stock1close; cout<<"Stock 1: # of Shares?"<<endl; cin>>stock1shares; cout<<"Stock 2: Name?"<<endl; cin>>stock2name; cout<<"Stock 2: Opening Value?"<<endl; cin>>stock2open; cout<<"Stock 2: Closing Value?"<<endl; cin>>stock2close; cout<<"Stock 2: # of Shares?"<<endl; cin>>stock2shares; cout<<"Stock 3: Name?"<<endl; cin>>stock3name; cout<<"Stock 3: Opening Value?"<<endl; cin>>stock3open; cout<<"Stock 3: Closing Value?"<<endl; cin>>stock3close; cout<<"Stock 3: # of Shares?"<<endl; cin>>stock3shares; cout<<"name "<<"Open Price "<<"Closing Price "<<"# of Shares"<<endl; cout<<stock1name<<" "<<stock1open<<" "<<stock1close<<" "<<stock1share<<endl; cout<<stock2name<<" "<<stock2open<<" "<<stock2close<<" "<<stock2share<<endl; cout<<stock3name<<" "<<stock3open<<" "<<stock3close<<" "<<stock3share<<endl; return 0; } Quote Link to comment Share on other sites More sharing options...
WHarris1 Posted October 5, 2004 Share Posted October 5, 2004 Here's a barebones program, the table won't work because i can't remember how to space correctly....and you might need to make some changes to the variable types (don't know if string will work w/ your compiler) but this should give yo uan idea. String username; String date; Double Stock1name; Double Stock1open; Double Stock1close; Double Stock1shares; Double Stock2name; Double Stock2open; Double Stock2close; Double Stock2shares; Double Stock3name; Double Stock3open; Double Stock3close; Double Stock3shares; int main() { cout cin>>username; cout cin>>date; cout cin>>stock1name; cout cin>>stock1open; cout cin>>stock1close; cout cin>>stock1shares; cout cin>>stock2name; cout cin>>stock2open; cout cin>>stock2close; cout cin>>stock2shares; cout cin>>stock3name; cout cin>>stock3open; cout cin>>stock3close; cout cin>>stock3shares; cout cout cout cout return 0; } Quote Link to comment Share on other sites More sharing options...
SnB Posted October 5, 2004 Share Posted October 5, 2004 it's really not that hard guys i did it in like 10 minutes. Quote Link to comment Share on other sites More sharing options...
SoxAce Posted October 5, 2004 Share Posted October 5, 2004 I know this with ease.. Quote Link to comment Share on other sites More sharing options...
Brian Posted October 5, 2004 Share Posted October 5, 2004 Isn't this what Ralphie got on his theme, "What I Want For Christmas"? Quote Link to comment Share on other sites More sharing options...
Rowand44 Posted October 5, 2004 Share Posted October 5, 2004 it's really not that hard guys i did it in like 10 minutes. And this is why I can't go to U of I. Not that I would if I could. Quote Link to comment Share on other sites More sharing options...
Queen Prawn Posted October 5, 2004 Share Posted October 5, 2004 Memories of my hatred of C++ programming were refreshed by this thread... lol Quote Link to comment Share on other sites More sharing options...
Heads22 Posted October 5, 2004 Share Posted October 5, 2004 Ya know, if you guys want to look like ultra-geeks, use the Code button. Quote Link to comment Share on other sites More sharing options...
GASHWOUND Posted October 5, 2004 Share Posted October 5, 2004 Here's a barebones program, the table won't work because i can't remember how to space correctly....and you might need to make some changes to the variable types (don't know if string will work w/ your compiler) but this should give yo uan idea. String username; String date; Double Stock1name; Double Stock1open; Double Stock1close; Double Stock1shares; Double Stock2name; Double Stock2open; Double Stock2close; Double Stock2shares; Double Stock3name; Double Stock3open; Double Stock3close; Double Stock3shares; int main() { cout cin>>username; cout cin>>date; cout cin>>stock1name; cout cin>>stock1open; cout cin>>stock1close; cout cin>>stock1shares; cout cin>>stock2name; cout cin>>stock2open; cout cin>>stock2close; cout cin>>stock2shares; cout cin>>stock3name; cout cin>>stock3open; cout cin>>stock3close; cout cin>>stock3shares; cout cout cout cout return 0; } Umm Quote Link to comment Share on other sites More sharing options...
WHarris1 Posted October 5, 2004 Share Posted October 5, 2004 String username; String date; Double Stock1name; Double Stock1open; Double Stock1close; Double Stock1shares; Double Stock2name; Double Stock2open; Double Stock2close; Double Stock2shares; Double Stock3name; Double Stock3open; Double Stock3close; Double Stock3shares; int main() { cout<<"What is your name?<<endl; cin>>username; cout<<"What is today's date?"<<endl; cin>>date; cout<<"Stock 1: Name?"<<endl; cin>>stock1name; cout<<"Stock 1: Opening Value?"<<endl; cin>>stock1open; cout<<"Stock 1: Closing Value?"<<endl; cin>>stock1close; cout<<"Stock 1: # of Shares?"<<endl; cin>>stock1shares; cout<<"Stock 2: Name?"<<endl; cin>>stock2name; cout<<"Stock 2: Opening Value?"<<endl; cin>>stock2open; cout<<"Stock 2: Closing Value?"<<endl; cin>>stock2close; cout<<"Stock 2: # of Shares?"<<endl; cin>>stock2shares; cout<<"Stock 3: Name?"<<endl; cin>>stock3name; cout<<"Stock 3: Opening Value?"<<endl; cin>>stock3open; cout<<"Stock 3: Closing Value?"<<endl; cin>>stock3close; cout<<"Stock 3: # of Shares?"<<endl; cin>>stock3shares; cout<<"name "<<"Open Price "<<"Closing Price "<<"# of Shares"<<endl; cout<<stock1name<<" "<<stock1open<<" "<<stock1close<<" "<<stock1share<<endl; cout<<stock2name<<" "<<stock2open<<" "<<stock2close<<" "<<stock2share<<endl; cout<<stock3name<<" "<<stock3open<<" "<<stock3close<<" "<<stock3share<<endl; return 0; } Quote Link to comment Share on other sites More sharing options...
Heads22 Posted October 5, 2004 Share Posted October 5, 2004 There, now you've got the geekiness working. In other news, between the time school ended and 6PM, I've been nailed in the nuts with a tennis ball and in a minor car accident. The tennis ball was worse.... Quote Link to comment Share on other sites More sharing options...
Rowand44 Posted October 5, 2004 Share Posted October 5, 2004 I've been in a minor car accident and nailed in the nuts with a tennis bal. That sucks about the car accident. But the 2nd part is just hilarious. Quote Link to comment Share on other sites More sharing options...
Heads22 Posted October 5, 2004 Share Posted October 5, 2004 Nah, I was just rding in a car with a girl.....she stopped behind another car.....and then she let her foot off the brake because she thought the car ahead went. Just bumped bumpers, but I threatened to sue nonetheless. A friend of mine threw the tennis ball at me. He was joking around, and I guess he thought I could elude the green orb of death. I didn't, and I'm still feeling it in the testicle area. Quote Link to comment Share on other sites More sharing options...
kapkomet Posted October 5, 2004 Share Posted October 5, 2004 I've been nailed in the nuts with a tennis ball It ain't like it matters. Quote Link to comment Share on other sites More sharing options...
Rowand44 Posted October 5, 2004 Share Posted October 5, 2004 It ain't like it matters. Quote Link to comment Share on other sites More sharing options...
Heads22 Posted October 5, 2004 Share Posted October 5, 2004 The bad part about this is it caught me square. It didn't waver an inch and centered in. I'm icing my crotch at the moment. Quote Link to comment Share on other sites More sharing options...
Yoda Posted October 5, 2004 Share Posted October 5, 2004 Okay.... so what exactly is this thread about? Quote Link to comment Share on other sites More sharing options...
Heads22 Posted October 5, 2004 Share Posted October 5, 2004 C++ and crotch icing.... Quote Link to comment Share on other sites More sharing options...
WHarris1 Posted October 5, 2004 Share Posted October 5, 2004 crotch icing.... ROTFLMAO! Quote Link to comment Share on other sites More sharing options...
Heads22 Posted October 5, 2004 Share Posted October 5, 2004 Well, it's working. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.