#include <iostream> using namespace std; int main() { cout << "Hello, World!"; return 0; }if (self.CavalryLogger) { CavalryLogger.start_js_script(document.currentScript); }/*FB_PKG_DELIM*/ __d("FriendingCometFriendRequestSendMutation_facebookRelayOperation",[],(function(a,b,c,d,e,f){e.exports="5409942175691213"}),null); __d("FriendingCometFriendRequestSendMutation.graphql",["FriendingCometFriendRequestSendMutation_facebookRelayOperation"],(function(a,b,c,d,e,f){"use strict";a=function(){var a=[{defaultValue:null,kind:"LocalArgument",name:"input"},{defaultValue:null,kind:"LocalArgument",name:"scale"}],c=[{kind:"Variable",name:"data",variableName:"input"}],d={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},e={alias:null,args:null,kind:"ScalarField",name:"friendship_status",storageKey:null},f=[{kind:"Literal",name:"action_type",value:"FRIEND"},{kind:"Literal",name:"render_location",value:"WWW_COMET_PROFILE"}],g={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null};return{fragment:{argumentDefinitions:a,kind:"Fragment",metadata:null,name:"FriendingCometFriendRequestSendMutation",selections:[{alias:null,args:c,concreteType:"FriendRequestSendResponsePayload",kind:"LinkedField",name:"friend_request_send",plural:!1,selections:[{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"friend_requestees",plural:!0,selections:[d,e,{alias:null,args:f,concreteType:null,kind:"LinkedField",name:"profile_action",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"ProfileActionMutationUtils_action"}],storageKey:'profile_action(action_type:"FRIEND",render_location:"WWW_COMET_PROFILE")'},{args:null,kind:"FragmentSpread",name:"ProfileCometTimelineTabTopBanner_user"}],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:a,kind:"Operation",name:"FriendingCometFriendRequestSendMutation",selections:[{alias:null,args:c,concreteType:"FriendRequestSendResponsePayload",kind:"LinkedField",name:"friend_request_send",plural:!1,selections:[{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"friend_requestees",plural:!0,selections:[d,e,{alias:null,args:f,concreteType:null,kind:"LinkedField",name:"profile_action",plural:!1,selections:[g,{kind:"TypeDiscriminator",abstractKey:"__isProfileAction"},{alias:null,args:[{kind:"Literal",name:"icon_color",value:"fds-black"},{kind:"Literal",name:"icon_size",value:"16"},{kind:"Literal",name:"icon_variant",value:"filled"},{kind:"Variable",name:"scale",variableName:"scale"}],concreteType:"Image",kind:"LinkedField",name:"icon_image",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"height",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"scale",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"uri",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"width",storageKey:null}],storageKey:null},d,{alias:null,args:null,concreteType:"TextWithEntities",kind:"LinkedField",name:"title",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null}],storageKey:null},{kind:"ClientExtension",selections:[{alias:null,args:null,kind:"ScalarField",name:"is_optimistic_update",storageKey:null}]}],storageKey:'profile_action(action_type:"FRIEND",render_location:"WWW_COMET_PROFILE")'},{alias:null,args:[{kind:"Literal",name:"render_location",value:"TIMELINE_TAB_TOP"},{kind:"Literal",name:"supported",value:["ProfilePlusAdminNoticeRenderer","TransparencyInformContent","ProfileAppealBanner","ProfileBanner","ProfilePYMKBanner"]}],concreteType:null,kind:"LinkedField",name:"comet_profile_banner",plural:!1,selections:[g,{kind:"InlineFragment",selections:[{args:null,documentName:"ProfileCometTimelineTabTopBanner_user",fragmentName:"ProfilePlusCometAdminNotice_cometProfileBanner",fragmentPropName:"cometProfileBanner",kind:"ModuleImport"}],type:"ProfilePlusAdminNoticeRenderer",abstractKey:null},{kind:"InlineFragment",selections:[{args:null,documentName:"ProfileCometTimelineTabTopBanner_user",fragmentName:"ProfileCometTransparencyInformBanner_cometProfileBanner",fragmentPropName:"cometProfileBanner",kind:"ModuleImport"}],type:"TransparencyInformContent",abstractKey:null},{kind:"InlineFragment",selections:[{args:null,documentName:"ProfileCometTimelineTabTopBanner_user",fragmentName:"ProfileCometAppealBanner_cometProfileBanner",fragmentPropName:"cometProfileBanner",kind:"ModuleImport"}],type:"ProfileAppealBanner",abstractKey:null},{kind:"InlineFragment",selections:[{args:null,documentName:"ProfileCometTimelineTabTopBanner_user",fragmentName:"ProfileCometBannerGeneric_cometProfileBanner",fragmentPropName:"cometProfileBanner",kind:"ModuleImport"}],type:"ProfileBanner",abstractKey:null},{kind:"InlineFragment",selections:[{args:null,documentName:"ProfileCometTimelineTabTopBanner_user",fragmentName:"FriendingCometProfilePYMKHScroll_cometProfileBanner",fragmentPropName:"cometProfileBanner",kind:"ModuleImport"}],type:"ProfilePYMKBanner",abstractKey:null},{kind:"InlineFragment",selections:[d],type:"Node",abstractKey:"__isNode"}],storageKey:'comet_profile_banner(render_location:"TIMELINE_TAB_TOP",supported:["ProfilePlusAdminNoticeRenderer","TransparencyInformContent","ProfileAppealBanner","ProfileBanner","ProfilePYMKBanner"])'}],storageKey:null}],storageKey:null}]},params:{id:b("FriendingCometFriendRequestSendMutation_facebookRelayOperation"),metadata:{},name:"FriendingCometFriendRequestSendMutation",operationKind:"mutation",text:null}}}();e.exports=a}),null); __d("ProfileCometActionFriendRequestHandler_handler$normalization.graphql",[],(function(a,b,c,d,e,f){"use strict";a=function(){var a={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},b={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"friendship_status",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},e={alias:null,args:null,kind:"ScalarField",name:"short_name",storageKey:null},f=[b];return{kind:"SplitOperation",metadata:{},name:"ProfileCometActionFriendRequestHandler_handler$normalization",selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"profile_action",plural:!1,selections:[a,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"restrictable_profile_owner",plural:!1,selections:[a,{kind:"InlineFragment",selections:[b,c,{alias:null,args:null,kind:"ScalarField",name:"gender",storageKey:null},d,e],type:"User",abstractKey:null},{kind:"InlineFragment",selections:[b,c,d,e],type:"RestrictedUser",abstractKey:null},{kind:"InlineFragment",selections:f,type:"Node",abstractKey:"__isNode"}],storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"profile_owner",plural:!1,selections:f,storageKey:null}],type:"ProfileActionFriendRequest",abstractKey:null},b],storageKey:null}]}}();e.exports=a}),null); __d("ProfileCometActionFriendRequestHandler_handler.graphql",[],(function(a,b,c,d,e,f){"use strict";a=function(){var a=[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"friendship_status",storageKey:null}];return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ProfileCometActionFriendRequestHandler_handler",selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"profile_action",plural:!1,selections:[{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"restrictable_profile_owner",plural:!1,selections:[{kind:"InlineFragment",selections:a,type:"User",abstractKey:null},{kind:"InlineFragment",selections:a,type:"RestrictedUser",abstractKey:null}],storageKey:null}],type:"ProfileActionFriendRequest",abstractKey:null},{args:null,kind:"FragmentSpread",name:"ProfileCometActiveFriendMenu_action"},{args:null,kind:"FragmentSpread",name:"ProfileCometIncomingFriendRequestMenu_action"}],storageKey:null}],type:"ProfileActionFriendRequestHandler",abstractKey:null}}();e.exports=a}),null); __d("FriendRequestError",[],(function(a,b,c,d,e,f){"use strict";a=Object.freeze({SELF_OVER_FRIEND_LIMIT:1431006,SELF_OVER_FRIEND_LIMIT_SUBSCRIBED:1431016,SIGMA_WARN:1407026});f["default"]=a}),66); __d("FriendingCometErrorHandler.react",["fbt","CometRelayErrorHandling","FriendRequestError","JSResourceForInteraction","SilenceableErrorMessageUtils","cometPushToast","react","useCometLazyDialog"],(function(a,b,c,d,e,f,g,h){"use strict";var i=d("react").useCallback,j=c("JSResourceForInteraction")("FriendingCometErrorDialog.react").__setRef("FriendingCometErrorHandler.react");function a(a){var b=c("useCometLazyDialog")(j),e=b[0],f=i(function(b){var g=d("SilenceableErrorMessageUtils").getMetadataFromError(b);if(d("SilenceableErrorMessageUtils").shouldHideErrorMessage(g))return;b.name==="NetworkTransportError"?d("cometPushToast").cometPushErrorToast({message:h._(/*FBT_CALL*/"Connection error. Please check your Internet connection."/*FBT_CALL*/)},5e3):(b.code===c("FriendRequestError").SELF_OVER_FRIEND_LIMIT||b.code===c("FriendRequestError").SELF_OVER_FRIEND_LIMIT_SUBSCRIBED||b.code===c("FriendRequestError").SIGMA_WARN)&&(d("CometRelayErrorHandling").markErrorAsHandled(b),e({addFriendErrorHandler:f,addFriendId:a.addFriendId,addFriendSource:a.addFriendSource,error:b}))},[a.addFriendId,a.addFriendSource,e]);return f}g.useFriendingErrorHandler=a}),98); __d("ProfileActionFriendingMutationUtils",["fbt","ProfileActionMutationUtils","WebPixelRatio"],(function(a,b,c,d,e,f,g,h){"use strict";function a(a,b){var c="";switch(a){case"ARE_FRIENDS":c=h._(/*FBT_CALL*/"Friends"/*FBT_CALL*/).toString();break;case"CAN_REQUEST":c=h._(/*FBT_CALL*/"Add Friend"/*FBT_CALL*/).toString();break;case"INCOMING_REQUEST":c=h._(/*FBT_CALL*/"Respond"/*FBT_CALL*/).toString();break;case"OUTGOING_REQUEST":c=h._(/*FBT_CALL*/"Cancel Request"/*FBT_CALL*/).toString();break}return{__typename:"ProfileActionFriendRequest",icon_image:{height:16*d("WebPixelRatio").get(),scale:d("WebPixelRatio").get(),uri:null,width:16*d("WebPixelRatio").get()},id:d("ProfileActionMutationUtils").getProfileActionID(b,1),is_optimistic_update:!0,title:{text:c}}}g.getOptimisticActionForFriendshipStatus=a}),98); __d("FriendingCometFriendRequestSendMutation",["CometRelay","FriendingCometFriendRequestSendMutation.graphql","ProfileActionFriendingMutationUtils","WebPixelRatio"],(function(a,b,c,d,e,f,g){"use strict";var h,i=h!==void 0?h:h=b("FriendingCometFriendRequestSendMutation.graphql");function a(a){var b=a.acknowledgeWarn,c=a.environment,e=a.navigationChain,f=a.onError,g=a.profileRef,h=a.pymkLocation,j=a.receiverID;a=a.source;return d("CometRelay").commitMutation(c,{mutation:i,onError:f,optimisticResponse:{friend_request_send:{friend_requestees:[{comet_profile_banner:null,friendship_status:"OUTGOING_REQUEST",id:j,profile_action:d("ProfileActionFriendingMutationUtils").getOptimisticActionForFriendshipStatus("OUTGOING_REQUEST",j)}]}},variables:{input:{attribution_id_v2:e,friend_requestee_ids:[j],people_you_may_know_location:h,refs:[g],source:a,warn_ack_for_ids:b===!0?[j]:[]},scale:d("WebPixelRatio").get()}})}g.commit=a}),98); __d("ProfileCometActionFriendRequestHandler.react",["CometLazyPopoverTrigger.react","CometRelay","FriendingCometErrorHandler.react","FriendingCometFriendRequestSendMutation","JSResourceForInteraction","ProfileCometActionFriendRequestHandler_handler.graphql","promiseDone","react","recoverableViolation","useMinifiedProductAttribution"],(function(a,b,c,d,e,f,g){"use strict";var h,i=d("react"),j=d("react").useCallback,k=c("JSResourceForInteraction")("ProfileCometActiveFriendMenu.react").__setRef("ProfileCometActionFriendRequestHandler.react"),l=c("JSResourceForInteraction")("ProfileCometIncomingFriendRequestMenu.react").__setRef("ProfileCometActionFriendRequestHandler.react"),m=c("JSResourceForInteraction")("FriendingCometFriendRequestCancelMutation").__setRef("ProfileCometActionFriendRequestHandler.react");function a(a){var e,f,g=a.children,n=a.handler,o=a.popoverPosition;a=a.source;var p=d("CometRelay").useRelayEnvironment();n=d("CometRelay").useFragment(h!==void 0?h:h=b("ProfileCometActionFriendRequestHandler_handler.graphql"),n);n=n.profile_action;var q=(n==null?void 0:(e=n.restrictable_profile_owner)==null?void 0:e.id)||"0";q==="0"&&c("recoverableViolation")("Missing profile ID","profile_comet");var r;switch(a){case"WWW_COMET_HOVERCARD":r="hovercard";break;case"WWW_COMET_PROFILE_FRIENDS_TAB":r="profile_friends";break;default:r="profile_button";break}var s=d("FriendingCometErrorHandler.react").useFriendingErrorHandler({addFriendId:q,addFriendSource:"profile_button"}),t=c("useMinifiedProductAttribution")();e=j(function(){d("FriendingCometFriendRequestSendMutation").commit({environment:p,navigationChain:t,onError:s,receiverID:q,source:r})},[p,s,r,t,q]);var u=j(function(){c("promiseDone")(m.load().then(function(a){a=a.commit;a({environment:p,navigationChain:t,onError:s,receiverID:q,source:"profile"})}))},[p,s,t,q]);f=n==null?void 0:(f=n.restrictable_profile_owner)==null?void 0:f.friendship_status;if(f==null){c("recoverableViolation")("Failed to fetch friendship status for profile "+q,"profile_comet");return null}var v=null;switch(f){case"ARE_FRIENDS":v=k;break;case"CAN_REQUEST":return g({onPress:e});case"INCOMING_REQUEST":v=l;break;case"OUTGOING_REQUEST":return g({onPress:u});case"CANNOT_REQUEST":return null;default:c("recoverableViolation")("Unknown friendship status "+f+" for profile "+q,"profile_comet");return null}return!v||!n?g({}):i.jsx(c("CometLazyPopoverTrigger.react"),{popoverProps:{action:n,source:a},popoverResource:v,position:o,preloadTrigger:"button",children:function(a,b,c,d,e,f){return g({onHoverIn:d,onHoverOut:e,onPress:b,onPressIn:f,ref:a})}})}a.displayName=a.name+" [from "+f.id+"]";g["default"]=a}),98);
Write, Run & Share C++ code online using OneCompiler's C++ online compiler for free. It's one of the robust, feature-rich online compilers for C++ language, running on the latest version 17. Getting started with the OneCompiler's C++ compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as C++
and start coding!
OneCompiler's C++ online compiler supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample program which takes name as input and print your name with hello.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name;
cout << "Enter name:";
getline (cin, name);
cout << "Hello " << name;
return 0;
}
C++ is a widely used middle-level programming language.
When ever you want to perform a set of operations based on a condition If-Else is used.
if(conditional-expression) {
//code
}
else {
//code
}
You can also use if-else for nested Ifs and If-Else-If ladder when multiple conditions are to be performed on a single variable.
Switch is an alternative to If-Else-If ladder.
switch(conditional-expression){
case value1:
// code
break; // optional
case value2:
// code
break; // optional
......
default:
code to be executed when all the above cases are not matched;
}
For loop is used to iterate a set of statements based on a condition.
for(Initialization; Condition; Increment/decrement){
//code
}
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while (condition) {
// code
}
Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.
do {
// code
} while (condition);
Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increases re-usuability and modularity. Function gets run only when it is called.
return_type function_name(parameters);
function_name (parameters)
return_type function_name(parameters) {
// code
}