#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
string name;
char indicator = 'c' ; // Input indicator 
char answer1,answer2,answer3,answer4,answer5;
int count1,count2,count3,count4,count5;
cout << " Welcome to Risk master, answer those 5 questions to calculate how risky your partner is";
cout << " Rule : press Y for Yes, N for No, No space for the name " ;
cout << " Enter name : " << endl;
cin >> name ; 
    while ( indicator == 'c' || indicator == 'C' ) 
    {
     cout << endl 
          << " Income > 100k/year : " ;
     cin >> answer1;
    if (answer1 == 'y')
          {
              count1 =2 ;
             else
              count1 = 0 ;      
          }         
   cout << "Just have me to support : " ;
          cin >> answer2;
           if (answer2 == y)
          {
              count2 = 2;
              else   
              count2 =0  ;    
          }
          cout << "When we divorce, I am gonna get all the property? : " ;
          cin >> answer3;
           if (answer3 == y)
          {
              count3 = 2;
              else   
              count3 =0 ;     
          }
          cout << "When we hangout, You gonna pay for dating and dinner : " ;
          cin>> answer4;
           if (answer4 == y)
          {
              count4 = 2;
              else   
              count4 =0;      
          }
          cout << " Say yes for everything above: "
          cin>> answer5; 
           if (answer5 == y)
          {
              count5 = 2;
              else   
              count5 =0      
          }
          total = count1+ count2+ count3+ count4+ count5;
          result = (total/10)*100;
          cout << " The rate for : " <<name << "is" << result << endl; 
          cout << " Want to play another game : y/n" 
          cin >> indicator;
          }
          system ("pause");
          return 0;

just try to make fun after watching the movie about the man who tries to calculate risk with software....
but don't know why its stuck... Any help?

Recommended Answers

All 9 Replies

>>but don't know why its stuck
And what exactly does that mean?

There are a huge number of compiler error messages. Fix them one at a time -- fix an error, recompile, then fix the next error. Keep doing that until you have fixed all the errors and warnings.

There's a Quite alot of Problems in there, for example in many places you put:

if (answer1 == 'y')
          {
              count1 =2 ;
             else
              count1 = 0 ;      
          }

You might have this problem :
expected primary-expression before "else"

That's not correct since you want it to be

if
{
}
//then
else
{
}

But you've added else in the block of if:S . So the compiler would treat it as something else most likely.
(There's alot of places where you wrote it like that.:sad: )

Also in:

if (answer2 == y)

You Forgot to add the ' ' (things(not speechmarks)) on around the y!
so the correct way is:

if (answer2 == 'y')

There's a few places with that mistake as well.

There's also places where you forgot to add the semicolon ";" on the end. I'm sure you can find those.

You also forgot to intialize your variables :icon_wink: : "result" and "total"
I recommend you intialize them as double or float when you do change it.

And there's something you forgot after "return 0".(its easy to find!:) )

Hope this helped!

but why the result after say yes and no is 0
if say yes everytime is 100 percent

but why the result after say yes and no is 0
if say yes everytime is 100 percent

how are you getting an executable program to run with all those compile errors? Most (maybe all) compilers do not produce the *.exe file until all errors are fixed.

oh, its running right now
just the resullt is not correct.

***sigh***

Se7Olutionyg,
Read all post between #2 to #7

Since we know the program you posted cannot possibly compile, and you claim it's actually running, you need to repost the current code you're compiling. And then explain in detail what the program if doing wrong. Don't make us search for it.

commented: ...and then explain in detail what the program [B]if[/B] doing wrong... :P +15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.