“Otomatis di CPP” Kode Jawaban

c Auto

//When using auto variables, the data type is decided in initialisation

#include <iostream>
using namespace std;

int main() {
    auto IntegerVar=25;   //creates integer type variable
    auto FloatVar=26.77;  //creates float type variable
    auto StringVar="Hello";  //creates string type variable
    auto CharVar="C";   //creates char type variable
  
    cout<<"CREATING VARIABLES USING AUTO DATA TYPE\n\n";
    cout<<"Integer: "<<IntegerVar<<endl;
    cout<<"Float: "<<FloatVar<<endl;
    cout<<"String: "<<StringVar<<endl;
    cout<<"Char: "<<CharVar;
    
    cout<<"\n\n";
    return 0;
}
ALeonidou

Otomatis di CPP

#include<iostream>
#incllude<vector>
using namespace std;

int main() {
   vector<int> vec(10);       // Auto deduce type to be iterator of a vector of ints.
   for(auto it = vec.begin(); it != vec.end(); vec ++)
   {
      cin >> *it;
   }
   return 0;
}
Clear Corncrake

AUTO I CPP

auto n=1;
// this will make the type int, and you can't change trough the program;
cout << n;
// OR
auto n="how you doin'";
cout << n;
Healthy Hedgehog

Jawaban yang mirip dengan “Otomatis di CPP”

Pertanyaan yang mirip dengan “Otomatis di CPP”

Lebih banyak jawaban terkait untuk “Otomatis di CPP” di C++

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya