Here is the basic structure for a C++ application. If you're developing locally, you'll start with just a main function, but this step is unnecesary in a notebook environment.
#include <iostream>
#include <string>
int main(){
double x = static_cast<int>(5.5);
std::string y = "Hello world";
std::cout << x << std::endl;
std::cout << y << std::endl;
}
main();
int v = 5000;
std::cout << v << std::endl;
You can use variables defined in earlier cells:
std::cout << x << std::endl;
#include <stdio.h>
char name[30];
scanf("%29s", name);
printf("Hello %s", name);
#include <string>
#include <iostream>
std::string name = "Caleb";
std::cout << name.size() << std::endl;
name += " Curry";
std::cout << name << std::endl;
char you[] = "Subscriber";
std::cout << you << " is " << strlen(you) << " characters long" << std::endl;
//you += " forever"; //NOPE
std::string copy1 = name;
std::cout << copy1 << std::endl;
char copy2[11];
strcpy(copy2, you);
std::cout << copy2 << std::endl;
std::cin >> name;
std::cout << name;
5 Caleb Curry Subscriber is 10 characters long Caleb Curry Subscriber
Tacos