Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Newbie in C++ Programming

Status
Not open for further replies.

devonsc

Advanced Member level 4
Joined
Nov 30, 2004
Messages
115
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,298
Activity points
1,931
Hi there,

Hope you guys don't mind me asking something real simple here. I'm trying to self-learn C++ programming. At the moment, I do understand simple programs but there are certain matters are being applied blindly without understanding. Such as:

The library used for a specific program, mind if I ask why and when we use the following libraries? =>

a.) iostream.h
b.) string.h

Thanks in advance.
 

You use iostream.h to control input/outputs like keyboard, monitor etc, samples are cin >> and cout <<, to get keyboard inputs and to write in monitor respectively and most others function related. String.h is to manipulate strings in some ways. A good book for self learn is "Thinking in C++" look for it in Google ... You can introduce libraries of the language or created by you to use functions that carry through definitive tasks without the necessity to write them at begin, this facilitates the creation of clean code. Sorry, but my english is terrible ...
 

string is used to declare "string of characters" like words. it is used to allocate the necessary memory size for data... however, i am not familiar with string.h, i think you mean just string. for example

int x;
float y;
char z;
string A;

scanf("%i",&x); \\for integer
scanf("%f",&y); \\for large numbers or numbers with decimal
scanf("%c",&z); \\for single characters or single leter
scanf("%s",&A); \\your input will be a string of characters, like "xxxxx".
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top