jueves, 20 de junio de 2013

Semana 10

#include<iostream>
using namespace std;

int main(){
  int x=5;
  {
      int x=4,y=2;
      {
          int x=9;
          cout<<x<<"\t"<<&x<<endl;
         cout<<y<<"\t"<<sizeof y<<endl;
      }
      cout<<x<<"\t"<<&x<<endl;
  }
  cout<<x<<"\t"<<&x<<endl;
  cin.get();
}

#include<iostream>
#include<string>
using namespace std;

int main(){
  cout<<"int:"<<sizeof (int)<<endl;
  cout<<"char:"<<sizeof (char)<<endl;
  cout<<"float:"<<sizeof (float)<<endl; 
  cout<<"double:"<<sizeof (double)<<endl;
  cout<<"bool:"<<sizeof (bool)<<endl;
  cout<<"long:"<<sizeof (long)<<endl; 

  string cadena="20 de julio de 2013";
  cout<<sizeof cadena<<"\t"<<cadena.size()<<endl;
  cin.get();
}


#include<iostream>
using namespace std;

int main(){
  int x[]={4, 5, 1, 2, 9};
  cout<<&x<<endl;
  cout<<&x[0]<<endl;
  cout<<&x[1]<<endl;
  cout<<&x[2]<<endl;
  cout<<&x[3]<<endl;
  cout<<&x[4]<<endl;
  cin.get();
}

No hay comentarios:

Publicar un comentario