if structure
Jan 12, 2013 at 8:31pm UTC
I need an if structure that assigns the value 100 to the variable named percent_complete if the character in the variable named Done equals Y.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream>
using namespace std;
int main ()
{
int percent_completed = 100;
char Done = 'Y' ;
cout << "What percent has been completed?" ;
cin >> percent_completed;
if (Done = 'Y' );
std:: cout << percent_complete = 100 << '\n' ;
return 0;
}
Last edited on Jan 12, 2013 at 8:37pm UTC
Jan 12, 2013 at 9:16pm UTC
1 2 3 4
if (Done == 'Y' ) // if the character in the variable named Done equals Y
{
percent_complete = 100; // assign the value 100 to the variable named percent_complete
}
Topic archived. No new replies allowed.