#include
using std::cout;
using std::endl;
int main(viod)
{
cout << endl << "This program prints numbers from 1 to 500."
for (int i = 1; i <= 500; i++)
{
cout << endl << i << ;
}
cout << endl;
system("PAUSE");
return 0;
}
bghjg
10 print "That is not a question." 20 print "That is a command." 30 end
how to write a program that counts automorphic number from 1 to 999
void print_evens (size_t n) {for (size_t x=0; x<=n; x+=2) { std::cout << x << std::endl; } }
Write a function that print a triangle of stars.
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); }
std::cout<<"computer"<<std::endl;
To check if a number is a palindrome, reverse the number and see if it is equal to the original number. If so, the number is a palindrome, otherwise it is not. To reverse a number, use the following function: int reverse(int num, int base=10) { int reverse=0; while( num ) { reverse*=base; reverse+=num%base; num/=base; } return(reverse); }
By learning how to program on C+.