Search
 
SCRIPT & CODE EXAMPLE
 

CPP

how to use tostring method in c++

#include <string>

struct Student {
    std::string name;
    int age;
    double finalGrade;

    std::string toString() {
        return "Name: " + 
            name + 
            "
 Age: " + 
            std::to_string(age) + 
            "
 Final Grade: " + 
            std::to_string(finalGrade);
    }
};
Comment

PREVIOUS NEXT
Code Example
Cpp :: program to convert int to int array c++ 
Cpp :: fast input and output c++ 
Cpp :: count function vector c++ 
Cpp :: modf() c++ 
Cpp :: how to delete a 2d dynamic array in c++ 
Cpp :: set precision in c++ 
Cpp :: class Solution { public: vector<vector<int threeSum(vector<int& nums) meaning 
Cpp :: calculate how many liters would be needed 
Cpp :: c++ random number generator 
Cpp :: c++ program to add two numbers using function 
Cpp :: cannot find -lsqlite3 C++ compiler error 
Cpp :: length of 2d array c++ 
Cpp :: qlabel font color 
Cpp :: C++ Area of a Rectangle 
Cpp :: binary exponentiation modulo m 
Cpp :: range of long long in c++ 
Cpp :: how to play sound in c++ 
Cpp :: c++ round number up 
Cpp :: c++ char array to int 
Cpp :: c++ mst kruskal 
Cpp :: reverse c++ string 
Cpp :: Appending a vector to a vector in C++ 
Cpp :: copy array c++ 
Cpp :: c++ check if char is number 
Cpp :: c++ construnctor 
Cpp :: slice std::array cpp 
Cpp :: convert binary string to int c++ 
Cpp :: cpp init multidimensional vector 
Cpp :: get window position 
Cpp :: convert string to lpwstr 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =