Tải bản đầy đủ (.pdf) (3 trang)

Baitap_Linux9 - Mang + Lap trinh C tren Linux

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (438.47 KB, 3 trang )

<span class='text_page_counter'>(1)</span><div class='page_container' data-page=1>

Bài t p Linux – ậ M ng + C/C++ạ
Bài 1: Các file c u hình m ngấ ạ


1. /etc/hosts


Xem file: cat /etc/hosts


192.168.1.34 ubuntu # Added by NetworkManager
127.0.0.1 localhost.localdomainlocalhost


::1 ubuntu localhost6.localdomain6 localhost6
127.0.1.1 ubuntu.ubuntu-domain ubuntu
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback


fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts


2. Xem thông tin v c u hình và thi t b m ngề ấ ế ị ạ
ifconfig


eth0 Link encap:Ethernet HWaddr 00:22:64:56:9d:7d
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000


RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)


Interrupt:22 Memory:e4600000-e4620000
lo Link encap:Local Loopback


inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host


UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0


RX bytes:720 (720.0 B) TX bytes:720 (720.0 B)
wlan0 Link encap:Ethernet HWaddr 00:1f:3c:c2:8d:20
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000


RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
3. C u hình m ng v i giao di n đ h aấ ạ ớ ệ ồ ọ


</div>
<span class='text_page_counter'>(2)</span><div class='page_container' data-page=2>

Bài t p Linux – ậ M ng + C/C++ạ


</div>
<span class='text_page_counter'>(3)</span><div class='page_container' data-page=3>

Bài t p Linux – ậ M ng + C/C++ạ


Đ t IPv4 : chon Ipv4 Setting. Method: Manual. Add: Adress, Netmask, Gatewayặ


Bài 2: L p trình C/C++ trong Linuxậ
1. Trình biên d ch C: gccị
2. Trình biên d ch C++: g++ị


3. Xem h ng d n: man gcc ướ ẫ


4. T o file helloworld.c v i n i dung sau trong gedit:ạ <sub>ớ</sub> ộ
#include <stdio.h>


int main()
{


printf("Hello World!");
}


Phân quy n: ề chmod u+x helloworld.c


Biên d ch file: ị gcc helloworld.c -o helloworld
Ch y ch ng trình: ạ ươ ./helloworld


5. Vi t ch ng trình tính t ng n sế ươ ổ ố
6. Vi t ch ng trình tính tích n s<sub>ế</sub> <sub>ươ</sub> <sub>ố</sub>


7. Vi t ch ng trình tính t ng các s l trong n sế ươ ổ ố ẻ ố
8. Vi t ch ng trình tính t ng các s ch n trong n sế ươ ổ ố ẳ ố
9. Vi t ch ng trình tính giai th a n!<sub>ế</sub> <sub>ươ</sub> <sub>ừ</sub>


10. Vi t ch ng trình ki m tra s n có ph i là s nguyên tế ươ ể ố ả ố ố


</div>

<!--links-->

×