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

Status
Not open for further replies.

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.webp
guys patulong naman po bago lang sa programming pano kaya ito? salamat sa makakatulong.
C++ po ang gamit.
 
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.org
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]
 
Status
Not open for further replies.

About this Thread

  • 9
    Replies
  • 795
    Views
  • 3
    Participants
Last reply from:
Lucyna Kushinada

Trending Topics

Online now

Members online
1,191
Guests online
1,390
Total visitors
2,581

Forum statistics

Threads
2,291,974
Posts
29,073,870
Members
1,210,122
Latest member
Armagedon134
Back
Top