answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: Which one of the following techniques do you use to yield the width of a string of text rendered with the Java2D API?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Declare a class called string - it must have constructors which allow definitions of objects in the following form - string name1 string name2minu string name3name2 in cpp?

There's no need to create a class to do this as std::string already does this and a lot more besides. The following class will do exactly as you've asked, but it's really just a wrapper for a std::string and achieves absolutely nothing. #include<iostream> class string{ public: string(std::string s=""):m_str(s){} string(const string& s):m_str(s.m_str){} const std::string& get_string(){return(m_str);} private: std::string m_str; }; int main() { string name1; string name2("minu"); string name3(name2); std::cout << "name1 = '" << name1.get_string().c_str() << "'" << std::endl; std::cout << "name2 = '" << name2.get_string().c_str() << "'" << std::endl; std::cout << "name3 = '" << name3.get_string().c_str() << "'" << std::endl; return(0); } Output: name1 = '' name2 = 'minu' name3 = 'minu'


C plus plus program to count digit in a string?

Use the following function to count the number of digits in a string. size_t count_digits (const std::string& str) { size_t count = 0; for (std::string::const_iterator it=str.begin(); it!=str.end(); ++it) { const char& c = *it; if (c>='0' && c<='9'); ++count; } return count; }


How do you close a string literal?

Just as you have started it. good examples: 'string' "string" `string` »string« bad examples: 'string" "string` »string'


1 Define a class in C plus plus to store following information of books Title Author Publisher Price?

class Book { public: Book(std::string title, std::string author, std::string publisher, double price) : m_title(title), m_author(author), m_publisher(publisher), m_price(price) {} std::string get_title()const{return(m_title);} std::string get_author()const{return(m_author);} std::string get_publisher()const{return(m_publisher);} int get_price()const{return(m_price);} private: std::string m_title; std::string m_author; std::string m_publisher; double m_price; }


Why strcat(string'!') not work in C program?

The strcat() function has the following protocol:char* strcat (char* destination, char* source);The function appends the source string to the destination string and returns the destination string.The destination string must be a null-terminated character array of sufficient length to accommodate strlen (source) plus strlen (destination) characters, plus a null-terminator. The existing null-terminator and subsequent characters of destination are overwritten by characters from the source string, up to and including the source string's null-terminator.strcat (string, '!') will not work because '!' is a character literal (ASCII code 33 decimal), not a null-terminated character array. Use "!" instead of '!'.Example:char string[80]; // character arraystrcpy (string, "Hello world");strcat (string, "!");puts (string);

Related questions

Which of the following is the highest voice in a string quartet?

violin


Which of the following is not a registry data type?

The following is not a registry data type: String Array.


Which of the following is NOT a main orchestral group or family?

Vibraphones


How do you string a dual line remington trimmer?

It is easy to string a dual line Remington trimmer by following the instructions in the manual. The manual was supplied with the trimmer when purchased.


Where can you string your tennis racquet?

You can generally string your tennis racquet at any of the following places:Specialized tennis storesTennis/Racquet clubsYour coach (coaches generally string your tennis racquets for you)Certain sporting goods storesTennis academies


Declare a class called string - it must have constructors which allow definitions of objects in the following form - string name1 string name2minu string name3name2 in cpp?

There's no need to create a class to do this as std::string already does this and a lot more besides. The following class will do exactly as you've asked, but it's really just a wrapper for a std::string and achieves absolutely nothing. #include<iostream> class string{ public: string(std::string s=""):m_str(s){} string(const string& s):m_str(s.m_str){} const std::string& get_string(){return(m_str);} private: std::string m_str; }; int main() { string name1; string name2("minu"); string name3(name2); std::cout << "name1 = '" << name1.get_string().c_str() << "'" << std::endl; std::cout << "name2 = '" << name2.get_string().c_str() << "'" << std::endl; std::cout << "name3 = '" << name3.get_string().c_str() << "'" << std::endl; return(0); } Output: name1 = '' name2 = 'minu' name3 = 'minu'


How can you convert from int to string in NET?

lets say you have the following: Dim Int1 as Integer=12 Dim String1 as String 'Very Simple String1=Int1.tostring


What does a vibrating guitar string do to the air aroung you?

if the musician playing the guitar is a woman, it will cause her intense pleasure. if strummed enough times, this pleasure will increase until a climatic harmonious "ooo" is vocally rendered by the musician.


The following is a run on sentence He's a very skilled cellist people call him Big String?

True


What is the code required to convert an integer variable to a string variable in Java?

There are several different methods to convert an integer variable to a string variable in Java. For example, one can use the following code to convert an integer variable to a string variable: Integer.toString(number)


C plus plus program to count digit in a string?

Use the following function to count the number of digits in a string. size_t count_digits (const std::string& str) { size_t count = 0; for (std::string::const_iterator it=str.begin(); it!=str.end(); ++it) { const char& c = *it; if (c>='0' && c<='9'); ++count; } return count; }


What country was Monteverdi from and what two string techniques did he introduce?

Born in Cremona, Italy and Introduced pizzicato & tremolo For for information visit http://musicanappreciation.blogspot.com/2010/02/baroque-composers.html