if structure

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
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.