#include
#include
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::getline;
int main()
{
string myString = "";
cout << "Enter a string: ";
getline(cin, myString, '#'); //will stop to read string when you press # (Shift + 3)
cout << endl << "You have entered: " << myString << endl;
system("PAUSE");
return 0;
}
void print_evens (size_t n) {for (size_t x=0; x<=n; x+=2) { std::cout << x << std::endl; } }
std::cout<<"computer"<<std::endl;
how to write a program that counts automorphic number from 1 to 999
Don't write, it is already written, google for 'cpp'.
Divide it by 1000.
10 print "That is not a question." 20 print "That is a command." 30 end
Write a function that print a triangle of stars.
bghjg
No.
Functions are very important in C++, as you can't write the simplest program to print hello without using a function. Overall you can say that function are building blocks of a C++ program. Functions can also be defined by the programmer to reduce program size.
#include <iostream> int main() { for(int i=51; i <= 100; i+=2) { cout << i << endl; } return 0; }
#include<iostream> int main() { std::cout<<"your name\nyour age"<<std::endl; return(0); }
void print_evens (size_t n) {for (size_t x=0; x<=n; x+=2) { std::cout << x << std::endl; } }
std::cout<<"computer"<<std::endl;
how to write a program that counts automorphic number from 1 to 999
By learning how to program on C+.
Yes. Use cin and/or getline to read the formatted data into an array, compute the average then output the result using cout.