You can do it simpler just by using preprocessor directive#include void main(){int a, b;cout > a;cout > b;cout b;for (int i =1; i
the code for the box is: # include <iostream> using namespace std; void main () { cout << "*********\n"; cout << "*\t*\n"; cout << "*\t*\n"; cout << "*\t*\n"; cout << "*\t*\n"; cout << "*\t*\n"; cout << "*\t*\n"; cout << "*\t*\n"; cout << "*********\n"; the code for the oval is: # include <iostream> using namespace std; void main () { cout << " ***\n"; cout <<" * *\n"; cout <<"* *\n"; cout <<"* *\n"; cout <<"* *\n"; cout <<"* *\n"; cout <<"* *\n"; cout <<" * *\n"; cout << " ***\n"; the code for the arrow is: # include <iostream> using namespace std; void main () { cout << " * \n"; cout <<" ***\n"; cout <<"*****\n"; cout <<" * \n"; cout <<" * \n"; cout <<" * \n"; cout <<" * \n"; cout <<" * \n"; the code for the diamond: # include <iostream> using namespace std; void main () { cout << " *\n "; cout <<" * *\n"; cout<<" * *\n"; cout<<" * *\n"; cout<<"* *\n"; cout<<" * *\n"; cout<<" * *\n"; cout <<" * *\n"; cout << " *\n "; }
#include <iostream> #include <string> using std::cin; using std::cout; using std::endl; using std::string; int main() { cout << "Enter name of your favorite TV show: \n"; string tvShow = ""; cin >> tvShow; for (int i = 0; i < 15; i++) { cout << endl << tvShow; } cout << endl << endl; system("PAUSE"); return 0; }
#include using std::cout;using std::endl;int main(viod){cout
#include using std::cin;using std::cout;using std::endl;int main(){double firstNumber = 0.0;cout > firstNumber;double secondNumber = 0.0;cout > secondNumber;cout
#include using std::cout;using std::endl;int main(){const int numToAdd = 100;int sum = 0;for (int i = 1; i
...#include ...double x;...cout > x;cout
COUT is an inbuilt function in c++ language. Cout is used to print something on to the standard output.
#include using std::cout;using std::endl;int main(){cout
#include #include using std::cin;using std::cout;using std::endl;using std::string;int main(void){string str1 = "nothing here";cout str1;string str2 = "neither here";cout str2;string srt = "result here";cout
#include<iostream.h> #include<conio.h> class student { protected: int rollno; char *name; public: void getdata(int b,char *n) { rollno = b; name = n; } void putdata(void) { cout<< " The Name Of Student \t: "<<name<<endl; cout<< " The Roll No. Is \t: "<<rollno<<endl; } }; class test:public student // Derieved Class 1 { protected: float m1,m2; public: void gettest(float b,float c) { m1 = b; m2 = c; } void puttest(void) { cout<< " Marks In CP Is \t: "<<m1<<endl; cout<< " Marks In Drawing Is \t:"<<m2<<endl; } }; class result:public test // Derieved Class 2 { protected: float total; public: void displayresult(void) { total = m1 + m2; putdata(); puttest(); cout<< " Total Of The Two \t: "<<total<<endl; } }; void main() { clrscr(); int x; float y,z; char n[20]; cout<<"Enter Your Name:"; cin>>n; cout<< "Enter The Roll Number:"; cin>>x; result r1; r1.getdata(x,n); cout<< "ENTER COMPUTER PROGRAMMING MARKS:"; cin>>y; cout<< "ENTER DRAWING MARKS:"; cin>>z; r1.gettest(y,z); cout<< endl<< endl<< "************ RESULT **************"<<endl; r1.displayresult(); cout<< "**********************************"<< endl; getch(); }
#include using std::cin;using std::cout;using std::endl;int main(){int numberM = 0;cout numberM;int numberN = 0;cout numberN;for (int i = (numberM + 1); i < numberN; i++){cout