Visual-C++
int zahl[8][8] = { 0
};
zahl[2][1] = 1;
zahl[4][2] = 2;
zahl[3][5] = 3;
zahl[6][7] = 4;
int i, j;
// Schleife fuer Zeilen, Y-Achse
for(i=0;
i<8;
i++) {
// Schleife fuer Spalten, X-Achse
for(j=0;
j<8;
j++) {
printf("%d ", zahl[i][j]);
}
printf("\n");
}
#include <stdio.h>
#include <io.h>
#include <iostream.h>
#pragma hdrstop
#pragma argsused
void CRDate(char *file,char &FDate){
//Datei öffnen
FILE *FStream;
FStream = fopen(file, "rt" );
//Dateieigenschaften auslesen
std::ftime DaTi;
if (FStream){
char d[2],m[2],y[4],h[2],mi[2],s[2];
getftime(fileno(FStream), &DaTi);
strcat (&FDate,itoa(DaTi.ft_day, d, 10) );
strcat (&FDate,"." );
strcat (&FDate,itoa(DaTi.ft_month , m, 10)
);
strcat (&FDate,"." );
strcat (&FDate,itoa(DaTi.ft_year+1980 , y,
10) );
strcat (&FDate," " );
strcat (&FDate,itoa(DaTi.ft_hour , h, 10));
strcat (&FDate,":");
strcat (&FDate,itoa(DaTi.ft_min , mi, 10));
strcat (&FDate,":");
strcat (&FDate,itoa(DaTi.ft_tsec , s, 10));
}
}
int main(int argc, char* argv[])
{
char FileDateDime[255]="";
CRDate("c:\\Autoexec.bat",*FileDateDime) ;
cout << "Erstellungsdatum: " << FileDateDime <<
"\n\n";
system ("pause");
return 0;
}
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
void circle(const double&, double&, double&);
int main(){
double radius = 0, umfang, flaeche;
//Headline
cout << " *** Berechnung Kreiswerte ***" << endl;
cout << setw(10) << "Radius"<< setw(10)
<< "Umfang"<< setw(10)
<< "Flaeche" << endl;
//Ausgabe: Radius, Fläche, Umfang
for (int i = 0;
i < 20;
i++)
{
radius += 0.5;
circle(radius, flaeche, umfang);
cout << setw(10) << fixed << setprecision (1) <<
radius;
cout << setw(10) << fixed << setprecision (3) <<
umfang;
cout << setw(10) << fixed << setprecision (3) <<
flaeche;
cout << endl;
}
string x;
cin >> x;
}
void circle(const double& radius, double& area, double&
circumference)
{
const double PI = 3.1415926536;
area = PI * radius * radius;
circumference = 2 * PI * radius;
}