What's new

Help Patulong naman po pano kaya code nito?(c++)

Lucyna Kushinada

Eternal Poster
Create a program that computes your score’s equivalent grade. Include cin in your program. Use the picture below as your reference for the output.
1606818293591.png

guys patulong naman po bago lang sa programming pano kaya ito? salamat sa makakatulong.
C++ po ang gamit.
 

Attachments

Solution
[CODE lang="cpp" title="without using conditon"]#include<iostream>
using namespace std;

int main()
{
string name;
int score, grade;
cout << "Total number of Item is 10" << name << endl;

cout << "Enter your name:";
cin >> name;

cout << "Enter your score:" ;
cin >> score;

grade = score * 50 / 10 + 50;

cout << name << "your grade is:" <<grade << endl;

return 0;
}[/CODE]
Master pa try ito haha, baka makatulong

Code:
#include <iostream>
using namespace std;
main()
{
    string fullname;
    float average;
    int name,score;
    
    
    cout<<"***Total no. of Items is 10***\n";
    
    cout<<"Enter kimi no nawa:\t";
    cin >> fullname;
    
    cout<<"Enter your score:\t";
    cin >> score;
    
    average = (score*10);
    cout<<"Kimi no nawa your average is:\t"<<average;
    return 0;
 
[CODE lang="cpp" title="without using conditon"]#include<iostream>
using namespace std;

int main()
{
string name;
int score, grade;
cout << "Total number of Item is 10" << name << endl;

cout << "Enter your name:";
cin >> name;

cout << "Enter your score:" ;
cin >> score;

grade = score * 50 / 10 + 50;

cout << name << "your grade is:" <<grade << endl;

return 0;
}[/CODE]
 
Solution
[CODE lang="cpp" title="Using condition"]#include<iostream> // Made by: Nino Nakano
using namespace std; // PhCorner.net
int main()



{
char name[50]; // variable declaration
double score, average;

a:

cout << "Total number of Item is 10" << endl; // Title
cout << "Enter your Name:"; // Request Name
cin >> name; // User Input (name)
cout << "Enter your Score:"; // Request Score
cin >> score; // User Input (score)

average = (score / 10 * 100); // formula

if (average >= 101) // condition 1
{
cout << name << " your grade is: Invalid" << endl;
}
else if (average == 0) // condition 2
{
cout << name << " your grade is: 0 " << endl;
}
else if (average == 100) // condition 3
{
cout << name << " your grade is: 100 " << endl;
}
else // if condition 1, 2, 3 is false
{
cout << name << " your grade is: " << average + 5 << endl;
}
goto a:
return 0;

} [/CODE]
 

Similar threads

Back
Top