Pages

Showing posts with label Programming for Engineers. Show all posts
Showing posts with label Programming for Engineers. Show all posts

Friday, August 20, 2010

Ubuntu Installation - Tips and tricks

There will be a session tomorrow on Saturday 21st of August 2010 at 11 am in the auditorium. You are all invited to attend. The session will focus on various methods of installing Ubuntu on your computers and related issues. Other issues related to installation of softwares, missing drivers or issues related to networking etc. will also be discussed.

Thursday, August 19, 2010

Friday, July 2, 2010

iostream buffer issues, cin, cout, cin.get, cin.getline

Here are useful links to iostream buffer related issues.

http://www.cplusplus.com/forum/beginner/7405/
http://www.cs.hmc.edu/~geoff/classes/hmc.cs070.200109/notes/io.html


you may also wish to read the chapter on I/O in the book by Walter Savitch, it is available in the library

In case you are having issues where your code seems to skip cin or cin.getline you can use
std::cin.ignore(std::numeric_limits::max(),'\n');
or, since you have 'using namespace std;', you can add this
cin.ignore(numeric_limits::max(),'\n');

to flush the buffer before you take input you will need to include ios.h and limits.h in order for it to work

sample

# include
# include
# include
# include
using namespace std;

int main()
{

.
.
.
.
.

string string1;
cin.ignore(numeric_limits::max(),'\n');
cin.getline(cin,string1);


}