d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Anyone Know Where I Can Find These Resources
Add Reply New Topic New Poll
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Jun 16 2012 10:58pm
First simple project for my class is to write a c++ program that tells a joke

It was supposed to just test our ability to like, use cout and some simple vi copying etc

we briefly touched on the cin function, and I kinda wanted to incorporate it into my program



So like, if I want the cin function to respond to a specific answer (like, if I go KNOCK KNOCK, I want the user to type "who's there"), how do I go about doing that.


Also, I am a terrible comedian and need joke ideas.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jun 16 2012 11:22pm
google examples for cin, cout, strings, if statements.
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Jun 16 2012 11:40pm
yep, just need.....a joke now
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jun 16 2012 11:46pm
i only know racy jokes. just google for em.

This post was edited by carteblanche on Jun 16 2012 11:54pm
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Jun 16 2012 11:54pm
I think that might get me negative points
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Jun 17 2012 12:02am
lol it's okay.....I don't know why....I am good at figuring out the technical stuff....but thinking of a joke? I spent like 2 hours trying to figure this one out.

Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Jun 17 2012 01:02am
http://pastebin.com/frcdSJSX

what I wrote. Professor trolled us and told us to save it as .p0, which vi won't compile. Need to write it again to test it.

edit: Yes, I know I am forcing the user to either admit error or be wrong. Tough luck for them :p, I can adjust it later....just want to make sure it works.

Code
error: could not convert `(&response)->std::basic_string<_CharT                                                           , _Traits, _Alloc>::operator= [with _CharT = char, _Traits = std::char_traits<ch                                                           ar>, _Alloc = std::allocator<char>](121)' to `bool'



getting that now....slightly changed the code (says line 20, which is where the if statement began)

http://pastebin.com/Yupjx1N4

This post was edited by Eep on Jun 17 2012 01:19am
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Jun 17 2012 01:37am
nvm....fixed it. First program is a go!

wooooo #shamelessfistbump
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll