Hello World [C]
Hello World [C++]Code:#include <stdio.h> int main(){ printf("Hello World"); getch(); }
Basic Input Output With Numbers and Words [C]Code:#include <iostream> using namespace std; int main(){ cout << "Hello World" << endl; system("pause"); }
Basic Input Output With Numbers and Words [C++]Code:#include <stdio.h> char name; //Variable for are name int number; //Varible for are number int main(){ printf("Enter your name: "); scanf("%s", &name); printf("Enter your number: "); scanf("%d", &number); system("cls"); printf("Hello %s, your number is %d", &name, number); getch(); }
Code:#include <iostream> #include <string> using namespace std; string name; //Variable for are name int number; //Variable for are number int main(){ cout << "Enter your name: "; getline(cin, name); //We use this instead of a normal cin to get the full name if the user entered any spaces cout << "Enter your number: "; cin >> number; system("cls"); cout << "Hello " << name << " your number is " << number << endl; system("pause"); }