Notes
![]() ![]() Notes - notes.io |
1)// Smart Array.cpp : Defines the entry point for the console application.
//
#include "stdafx.h";
#include <iostream>
using namespace std;
class Arr{
public:
int length;
int zgv[17];//Static array//
Arr(){
length = 17;
for (int i = 0; i < length; i++){
zgv[i] = 0;
} //zgv-i bolor elementnery 0-acvecin//
}
};
int _tmain(int argc, _TCHAR* argv[])
{
Arr zangvats;
cout << zangvats.zgv[5] << endl;
return 0;
}
Ekranin durs e grvelu 0.
2)#include "stdafx.h";
#include <iostream>
using namespace std;
class Arr{
public:
int length;
int zgv[17];//Static array//
Arr(){
length = 17;
for (int i = 0; i < length; i++){
zgv[i] = 0;
} //zgv-i bolor elementnery 0-acvecin//
}
int operator[] (int i){
return zgv[i];
} // puchiki miji 3rd elementy puchiki zangvatsi 3rd elemntn e//
};
int _tmain(int argc, _TCHAR* argv[])
{
Arr zangvats;
cout << zangvats[5] << endl;
return 0;
}
Ekranin durs e bervelu 0.
3)// Smart Array.cpp : Defines the entry point for the console application.
//
#include "stdafx.h";
#include <iostream>
using namespace std;
class Arr{
public:
int length;
int zgv[17];//Static array//
Arr(){
length = 17;
for (int i = 0; i < length; i++){
zgv[i] = 0;
} //zgv-i bolor elementnery 0-acvecin//
}
int& operator[] (int i){
return zgv[i];
} // puchiki miji 3rd elementy puchiki zangvatsi 3rd elemntn e//
};//Int& tuyl e talis zangvatsi tarber elementnerin tarber arjeq veragrel//
int _tmain(int argc, _TCHAR* argv[])
{
Arr zangvats;
zangvats[5] = 3;
cout << zangvats[5] << endl;
return 0;
}
4)#include "stdafx.h";
#include <iostream>
using namespace std;
class Arr{
public:
int length;
int zgv[17];//Static array//
Arr(){
length = 17;
for (int i = 0; i < length; i++){
zgv[i] = 0;
} //zgv-i bolor elementnery 0-acvecin//
}
int& operator[] (int i){
if (i> length-1 || i<0)
{
cout << "Out Array Range" << endl;
exit(1);
}
else
return zgv[i];
} // yete trvi sxal index tsragiry kang karni exit-i shnorhiv //
};
int _tmain(int argc, _TCHAR* argv[])
{
Arr zangvats;
zangvats[19] = 8;
return 0;
}
Ekranin durs kbervi Out of Array Range.
2.0 Troubleshooting
int y=zangvats[5]; => Right. int y receives the value of 5th element of zangvats static array
zangvats[5]=3; =>Wrong. Any value cannot be attributed to the 5th element of zangavts array.
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team