Function stringstream :)

Joined
Nov 15, 2007
Messages
3
Reaction score
0
Hello ;

I have problem can you help me ..

my project have function converts an integer to string
for example :
CS 201
this have two part :
first part an integer >> given automatically by system
second part a string>> insert by user
Iwant to conect between them in a string how??
see my code

PHP:
#include <iostream>
#include <string>
#include<sstream>
using namespace std;
#include "Course.h"

    int Course :: courseid = 200;
    Course :: Course (int C,string name2)
    {
    	setno_of_credits(C);
    	setcourseName(name2);
    	courseid++;
    }
	void Course :: setno_of_credits(int C)
	{
		no_of_credits = C;
	}
	int Course :: getno_of_credits()
	{
		return no_of_credits;
	}
	void  Course :: setcourseName(string name2)
	{
		courseName = name2;
	}
	string Course :: getcourseName()
	{
		return courseName;
	}

	string Course :: conection()
	{
		stringstream ss;
                        ss << courseid;
                       ss >> courseName;
                     cout<<courseName<<endl;
                     return courseName;
	}

	void Course:: print_infoCourse()
	{
	cout<<" The IdCourse is : "<<conection();
	}

PLZ help me :mrgreen:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top