473,757 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

function should have a prototype

1 New Member
Hi all,

I am new to C++...I tried to compile the following program...

#include<iostre am.h>
#include<conio. h>
#include<string >
#include<stdio. h>

int main() {
String mystr;
cout << "What is your name?";
getline(cin,mys tr);
cout << "my name is:" << mystr;
cout << "What is your favourite team?";
getline(cin, mystr);
cout << "My favourite team is " << mystr;
getch();
return 0;
}

but i am getting the error 'function getline should have a prototype'...I am getting other errors as well apart from this ...but i think if i can add the relevant "#include.. ." i can fix this error..can anyone please tell me what is it for 'getline' function...thnk in advnce...
Dec 31 '07
10 31099
bineet276
1 New Member
U can use the following code and execute . U would not get any error while compiling and executing the code. So proceed:-

#include<iostre am.h>
#include<conio. h>
#include<stdio. h>

int main()
{
clrscr();
char mystr[50];
cout<< "What is your name?\n";
gets(mystr);
cout<<"my name is:"<<mystr<<"\ n";
cout<<"What is your favourite team?\n";
gets(mystr);
cout<<"My favourite team is"<<mystr<<"\n ";
getch();
return 0;
}
Feb 21 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

22
6026
by: Ian | last post by:
The title says it all. I can see the case where a function is to be called directly from C, the name mangling will stuff this up. But I can't see a reason why a template function can't be given extern "C" linkage where it is to be assigned to a C function pointer. Ian
5
2091
by: Alfonso Morra | last post by:
Hi all, I came accross this FP signature and it has me baffled. Can anyone explain this signature to me - i.e what are the input and output types ? void(*(*foo)(int))(int,void(*)(int)) Thanks
3
3027
by: steven.ke | last post by:
Hi all, I am trying to use the sortBy function in the prototype.js library. Nevertheless, I can't work out what to include in the iterator function. Can someone shed some light on this? Thanks in advance.
13
105841
by: richasaraf | last post by:
Hi guys, Can someone help me... I want to know... can we have OUT, IN OUT parameters in function? :confused: And can we use it in select statement ? Thanks a lot ! Take Care Richa :)
4
1386
by: ygao | last post by:
>>compile('U"ÖÐ"','c:/test','single') <code object ? at 00F06B60, file "c:/test", line 1> <code object ? at 00F06BA0, file "c:/test", line 1> u'\xd6\xd0' u'\u4e2d' why is the result different? a bug or another reason?
5
2243
by: Daz | last post by:
Hi everyone. My query is very straight forward (I think). What's the difference between someFunc.blah = function(){ ; } and
5
2538
by: cyborg81 | last post by:
SOMEONE PLS HELP! im writing this code of a function prototype as follows: #include<iostream> #include<iomanip> using std::cin; using std::cout;
4
6641
by: mahendra23 | last post by:
can anybody tell me pure virtual function in c++ have body present or not?
2
1296
LeoTD
by: LeoTD | last post by:
Dear all, I have a problem: I want to execute some codes in page1 and return result in page2. In ASP, the Server.Transfer function is OK. But in PHP, i don't know have function could do it or not. Please help me!! Thanks a lot :D
0
9904
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9884
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9735
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8736
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7285
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6556
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
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 we have to send another system
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.