how to get average that is rounded integer

closed account (j1AR92yv)
I have to make a grading system and so far I have this.

#include "pch.h"
#include <iostream>
#include <string>
#include <iomanip>
#include <math.h>


int main()
{
std::string a;
std::cout << "Please enter first name. \n";
std::cin >> a;

std::string b;
std::cout << "Please enter last name. \n";
std::cin >> b;

double c, d, e;
std::cout << "Enter the three test scores. \n";
std::cin >> c;
std::cin >> d;
std::cin >> e;
double sum = c + d + e;
double ave = sum / 3;
std::round(ave);

std::cout << ave;


}

How do I get the average number of c, d, and e while also having the end result where it rounds. Like if the average is 7.58 then it will be
stored as 8, but if it was 6.46, then it will be stored as 6.
I would appreciate any help, please and thank you.
You need to assign round to something. Does that explain your question? 😅

So try double Ave = round(sum/3) ; 😉
good suggestion
Topic archived. No new replies allowed.