What do you want to save?
Add Code snippet
New code examples
-
-
C++ 2022-03-15 04:15:12
c++ void to avoid functions
/*The following example collects user data and formats it using seperate void statements */ #include <iostream> #include <string> #include <stdio.h> #include <stdlib.h> using namespace std; // function declarations void inputData... Add solution -
C++ 2022-02-09 22:20:01
Get input for array of unknown length/size in c++
#include<iostream> #include<sstream> using namespace std; int main() { string s; getline(cin, s); int data istringstream iss(s); while(iss>>data) cout<<data<<" "; return 0; } Add solution -
C++ 2021-11-13 22:52:09
c++ check first character of string
#include <iostream> #include <string> int main() { string str{}; // creating string getline(cin, str);// using getline for user input std::cout << str; // output string namePerson if (str[0] >= 'a' || str[0] <= 'z') ... Add solution -
C++ 2021-10-19 22:22:08
cin does not wait for input
/* cin stops taking input on whitespace encounter * so if you pass "Prakhar Patel" into cin>>name; * only "Prakhar" will be stored into name. * "Patel" will stay in stream and will come into next cin statement. */ getl... Add solution
Best helpers
Ranking is empty