473,493 Members | 4,347 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

some functions

I heard that the operators for string manipulations have been
overloaded in standard c++.
like for strcmp, we use == and for assignment, we use =. is it true?
also, what are the function equivalents in standard c++ for:
1.) clrscr(); //clear the screen
2.) gotoxy(int x_axis,int y_axis); // go to position in screen at x
axis and y axis

Dec 12 '06 #1
4 1121
MC felon wrote:
I heard that the operators for string manipulations have been
overloaded in standard c++.
like for strcmp, we use == and for assignment, we use =. is it true?
Almost, just the other way round. For "==" _you_ use strcmp
and for assignment ("=") _you_ use strcpy. :>

Trust me -- with C++ strings it is much harder to shoot yourself
in the foot than with C arrays of characters.
also, what are the function equivalents in standard c++ for:
1.) clrscr(); //clear the screen
2.) gotoxy(int x_axis,int y_axis); // go to position in screen at x
axis and y axis
There are none, AFAIR. Usually the platform you run your programs
on gives you a platform-specific means to do it, like "conio.h".
Might as well use them in C++.

HTH,
- J.
Dec 12 '06 #2

MC felon wrote:
I heard that the operators for string manipulations have been
overloaded in standard c++.
like for strcmp, we use == and for assignment, we use =. is it true?
also, what are the function equivalents in standard c++ for:
1.) clrscr(); //clear the screen
2.) gotoxy(int x_axis,int y_axis); // go to position in screen at x
axis and y axis
The std::string is a versatile class with many member functions and
operator overloads.
Overloading operators with any class is a C++ cornerstone.

[15.20] How can I clear the screen? Is there something like clrscr()?
http://www.parashift.com/c++-faq-lite/input-output.html

C++ doesn't rely on a screen to be available at all. If it did it
probably wouldn't be portable. While that might seem like a restriction
to you, its one of its strong points. C++ code doesn't confine itself
to any particular graphical user interface (or platform) although some
cross-platform GUI libraries are available.

Dec 12 '06 #3
On Dec 12, 12:01 pm, "MC felon" <paec....@gmail.comwrote:
I heard that the operators for string manipulations have been
overloaded in standard c++.
like for strcmp, we use == and for assignment, we use =. is it true?
Yes, but the really nice thing is the concatenation operator +, I can
concatenate strings together without having to worry about buffer
overflows and stuff like that and with a nice syntax:

std::string str = "Hello";
str += " World!";

--
Erik Wikström

Dec 12 '06 #4

MC felon wrote:
I heard that the operators for string manipulations have been
overloaded in standard c++.
You've heard that? It's certianly true, but if you want to become
proficient in C++ you need to be learning more efficiently than just
hearing about the occasional feature. You need a good textbook or two.

This is ideal if you have some programming experience
http://www.acceleratedcpp.com/

And this is an excellent reference for the standard library, including
(but by no means limited to) std::string
http://www.josuttis.com/libbook/

Gavin Deane

Dec 12 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

36
1987
by: Antoon Pardon | last post by:
I'm rather new at this, so I don't know how I should introduce this, nor whether these ideas are worth much but here goes. What I would like to change is access to variables on an intermediate...
16
2105
by: Michele Simionato | last post by:
I have read with interest the recent thread about closures. The funny thing is that the authors are arguing one against the other but I actually agree with all of them and I have a proposal that...
193
9363
by: Michael B. | last post by:
I was just thinking about this, specifically wondering if there's any features that the C specification currently lacks, and which may be included in some future standardization. Of course, I...
28
3286
by: Yuri CHUANG | last post by:
"No newline at the end of your output" is really a problem? I've never learned that before. So I desire to know some tips about writting a program perfectly.Can anyone give me some tips which are...
4
2104
by: Chris F Clark | last post by:
Please excuse the length of this post, I am unfortunately long-winded, and don't know how to make my postings more brief. I have a C++ class library (and application generator, called Yacc++(r)...
7
3107
by: Mark Healey | last post by:
Do the trig functions in math.h work in degrees, radians or what? For some reason it doesn't say which in "man math.h" IIRC the arctan of a slope gives the angle. So, shouldn't atanf((float)1)...
22
1726
by: Guru Jois | last post by:
Hai all, I have some question. Please answer. 1. What is walking pointer? 2. What is difference between procedure and subroutine? 3. What is template of main in C? 4. What is padding of...
9
2443
by: Jess | last post by:
Hello, It seems both static_cast and dynamic_cast can cast a base class pointer/reference to a derived class pointer/reference. If so, is there any difference between them? In addition, if I...
34
1854
by: sumedh..... | last post by:
double * X size of X->?? size of X->?? double (*X) size of X->?? size of X->??
26
1816
by: Frank Samuelson | last post by:
I love Python, and it is one of my 2 favorite languages. I would suggest that Python steal some aspects of the S language. ------------------------------------------------------- 1. Currently...
0
6980
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7192
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6862
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7364
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5452
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1397
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.