Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

C++ structure (Struct)

#include <iostream>

using namespace std;

struct book{
  string name;
  string author;
  int pages;
  float price;
};

int main(){
    book b1 = {"A tale of two cities", "William Shakespeare", 350, 99.9};
    cout << b1.name << endl;
}
 
PREVIOUS NEXT
Tagged: #structure
ADD COMMENT
Topic
Name
4+1 =