Witam jestem w 1 kl technikum informatycznym .Zrobiłem łatwy program na zaliczenie .Che podzielić go na funkcje ale coś mi nie wychodzi .np
+++++++++++++++++++++++++++++++
twoja baza
1.
2.
++++++++++++++++++++++++++++++
po wpisaniu danych nie wyświetla mi .Bez funkcji program działa bez problemu.
Proszę o pomoc
#include <iostream>
#include <conio.h>
#include <cstdio>
using namespace std;
int i,n,x,y=1;
int main()
{
cout<<"------------------------------------------"<<endl;
cout<<"ile rekordow chcesz dodac ?"<<" "<<endl;
cout<<"------------------------------------------"<<endl;
cin>>x;
cout<<endl;
string imie[2][x];
string nazwisko[2][x];
for (i=0;i<1;i++)
{
for (n=0;n<x;n++)
{
cout<<"--------------------------------------"<<endl;
cout<<"podaj imie nr: "<<n+1<<" ";
cin>>imie[i][n];
cout<<"podaj nazwisko nr: "<<n+1<<" ";
cin>>nazwisko[i][n];
cout<<"--------------------------------------"<<endl;
cout<<endl;
}
}
cout<<"+++++++++++++++++++++++++++++++++++++++"<<endl;
cout<<"Twoja baza :";
cout<<endl;
for (i=0;i<1;i++)
{
for (n=0;n<x;n++)
{
cout<<endl;
cout<<y++<<"."<<imie[i][n]<<" "<<nazwisko[i][n];
}
}
cout<<endl;
cout<<"+++++++++++++++++++++++++++++++++++++++"<<endl;
getch();
return 0;
}
usunięcie mnóstwa zbędnych pustych linii z kodu - fp