### Constantly repeating

Hello, I'm missing something very simple here. I would appreciate it if someone could tell me what exactly it is. As a training exercise I am writing up a quick function which asks what kind of soda you'd like to choose etc. Regardless when I run it, It constantly repeats it self. May have something to do with the answer being letters rather than numbers, not sure.

After that on-going typing here is the class

 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647`` ``````#include //@author Will A Cola Machine Training Exercise int main() { int soda = 0; int cocacola = 0; int sprite = 0; int pepsi = 0; int drpepper = 0; bool repeat = true; while(repeat) { std::cout<<"Soda Machine ||| Created By Will A.\n Inspired By BlitzCoder"; std::cout<<"\n\n\n\nPlease Enter CocaCola, Sprite, Pepsi or DrPepper:\n\n"; std::cin>>soda; if((cocacola)) { std::cout<<"\n\n\nYou recieve a can of Coca-Cola!\n"; } else if((sprite)) { std::cout<<"\n\n\nYou recieve a can of Sprite!\n"; } else if((pepsi)) { std::cout<<"\n\n\nYou recieve a can of Pepsi!\n"; } else if((drpepper)) { std::cout<<"\n\n\nYou recieve a can of DrPepper!\n"; } else { std::cout<<"Please choose the following!\nEnter CocaCola, Sprite, Pepsi or DrPepper:\n\n"; } } }``````

-Will
`std::string soda;` will do the trick

then:
 ``1234`` ``````if (soda=="pepsi") { cout << "lala"; }``````

Use string when you want to enter words
Last edited on
Okay, thanks.

I appreciate it.
How do you print screen and display code link that ?
@ IceyEyez
How to use code tags: http://www.cplusplus.com/articles/z13hAqkS/
Topic archived. No new replies allowed.