test.c 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. /* File comments
  2. * asdasdas
  3. * asd
  4. * a$d
  5. * asd
  6. * sad
  7. * as
  8. * das
  9. * dasd
  10. */
  11. int function_start(asdasd<asd>& asdasd, asdsad* adsadsad){
  12. return 0;
  13. }
  14. "string \\\\" /* comment */
  15. "string \\\\" /* comment \
  16. */
  17. asd
  18. " */ /* SCC has been trained to know about strings /* */ */"!
  19. "\"Double quotes embedded in strings, \\\" too\'!"
  20. "And \
  21. newlines in them"
  22. "And escaped double quotes at the end of a string\""
  23. aa '\\
  24. n' OK
  25. aa "\""
  26. aa "\
  27. \n"
  28. This is followed by C++/C99 comment number 1.
  29. // C++/C99 comment with \
  30. continuation character \
  31. on three source lines (this should not be seen with the -C fla
  32. The C++/C99 comment number 1 has finished.
  33. This is followed by C++/C99 comment number 2.
  34. /\
  35. /\
  36. C++/C99 comment (this should not be seen with the -C flag)
  37. The C++/C99 comment number 2 has finished.
  38. This is followed by regular C comment number 1.
  39. /\
  40. *\
  41. Regular
  42. comment
  43. *\
  44. /
  45. The regular C comment number 1 has finished.
  46. /\
  47. \/ This is not a C++/C99 comment!
  48. This is followed by C++/C99 comment number 3.
  49. /\
  50. \
  51. \
  52. / But this is a C++/C99 comment!
  53. The C++/C99 comment number 3 has finished.
  54. /\
  55. \* This is not a C or C++ comment!
  56. This is followed by regular C comment number 2.
  57. /\
  58. */ This is a regular C comment *\
  59. but this is just a routine continuation *\
  60. and that was not the end either - but this is *\
  61. \
  62. /
  63. The regular C comment number 2 has finished.
  64. This is followed by regular C comment number 3.
  65. /\
  66. \
  67. \
  68. \
  69. * C comment */
  70. #ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED
  71. #define BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED
  72. // (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
  73. // Copyright (c) 2001, 2002 Peter Dimov
  74. //
  75. // Distributed under the Boost Software License, Version 1.0. (See
  76. // accompanying file LICENSE_1_0.txt or copy at
  77. // http://www.boost.org/LICENSE_1_0.txt)
  78. //
  79. // http://www.boost.org/libs/smart_ptr/scoped_ptr.htm
  80. //
  81. #include <boost/assert.hpp>
  82. #include <boost/checked_delete.hpp>
  83. #include <boost/detail/workaround.hpp>
  84. #ifndef BOOST_NO_AUTO_PTR
  85. # include <memory> // for std::auto_ptr
  86. #endif
  87. namespace boost
  88. {
  89. // Debug hooks
  90. #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
  91. void sp_scalar_constructor_hook(void * p);
  92. void sp_scalar_destructor_hook(void * p);
  93. #endif
  94. // scoped_ptr mimics a built-in pointer except that it guarantees deletion
  95. // of the object pointed to, either on destruction of the scoped_ptr or via
  96. // an explicit reset(). scoped_ptr is a simple solution for simple needs;
  97. // use shared_ptr or std::auto_ptr if your needs are more complex.
  98. class tessss::enlcosed { funct(){}};
  99. // template specialization
  100. #include <iostream>
  101. using namespace std;
  102. // class template:
  103. template <class T>
  104. class mycontainer {
  105. T element;
  106. public:
  107. mycontainer (T arg) {element=arg;}
  108. T increase () {return ++element;}
  109. };
  110. // class template specialization:
  111. template <>
  112. class mycontainer <char> {
  113. char element;
  114. public:
  115. mycontainer (char arg) {element=arg;}
  116. char uppercase ()
  117. {
  118. if ((element>='a')&&(element<='z'))
  119. element+='A'-'a';
  120. return element;
  121. }
  122. };
  123. //
  124. int main () {
  125. mycontainer<int> myint (7);
  126. mycontainer<char> mychar ('j');
  127. cout << myint.increase() << endl;
  128. cout << mychar.uppercase() << endl;
  129. return 0;
  130. }
  131. template<class T> struct scoped_ptr::ass // noncopyable
  132. : public other_template<param>
  133. {
  134. private:
  135. T * px;
  136. str a = '\9'
  137. scoped_ptr(scoped_ptr const &);
  138. scoped_ptr & operator=(scoped_ptr const &);
  139. typedef scoped_ptr<T> this_type;
  140. void operator==( scoped_ptr const& ) const;
  141. void operator!=( scoped_ptr const& ) const;
  142. public:
  143. typedef T element_type;
  144. explicit ss::scoped_ptr ( T * p = 0 ): px( p ) // never throws
  145. {
  146. #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
  147. boost::sp_scalar_constructor_hook( px );
  148. #endif
  149. }
  150. explicit scoped_ptr( T * p = 0 ): px( p ) // never throws // double
  151. {
  152. //if(1) {}
  153. #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
  154. boost::sp_scalar_constructor_hook( px );
  155. #endif
  156. }
  157. #ifndef BOOST_NO_AUTO_PTR
  158. explicit scoped_ptr( std::auto_ptr<T> p ): px( p.release() ) // never throws
  159. {
  160. #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
  161. boost::sp_scalar_constructor_hook( px );
  162. #endif
  163. }
  164. #endif
  165. ~scoped_ptr() // never throws
  166. {
  167. #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
  168. boost::sp_scalar_destructor_hook( px );
  169. #endif
  170. boost::checked_delete( px );
  171. }void reset(T * p = 0) // never throws!
  172. {
  173. BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors
  174. this_type(p).swap(*this);
  175. }T & operator*() const // never throws
  176. {
  177. BOOST_ASSERT( px != 0 );
  178. return *px;
  179. }
  180. T * operator->() const // never throws
  181. {
  182. BOOST_ASSERT( px != 0 );
  183. return px;
  184. }
  185. T * operator float() const // never throws
  186. {
  187. BOOST_ASSERT( px != 0 );
  188. return px;
  189. }
  190. T * get() const // never throws
  191. {
  192. return px;
  193. }
  194. // implicit conversion to "bool"
  195. #include <boost/smart_ptr/detail/operator_bool.hpp>
  196. void swap(scoped_ptr & b) // never throws
  197. {
  198. T * tmp = b.px;
  199. b.px = px;
  200. px = tmp;
  201. }
  202. };
  203. struct XZ template<class T> inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) // never throws
  204. {
  205. a.swap(b);
  206. }
  207. // get_pointer(p) is a generic way to say p.get()
  208. template<class T> inline T * get_pointer(scoped_ptr<T> const & p)
  209. {
  210. return p.get();
  211. }
  212. } // namespace boost
  213. #endif // #ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED
  214. package studentuniversity1;
  215. import java.io.*;
  216. import Students.Student;
  217. import java.util.Scanner;
  218. public class Central {
  219. public static Student register() {
  220. Student kid = new Student();
  221. Scanner scnr = new Scanner(System.in);
  222. System.out.println("Enter information about the student");
  223. System.out.print("Student ID: ");
  224. kid.StudentIdentificationNumber = scnr.nextInt();
  225. System.out.print("First Name: ");
  226. kid.FirstName = scnr.next();
  227. System.out.print("Last Name: ");
  228. kid.LastName = scnr.next();
  229. System.out.print("Number of credits so far: ");
  230. kid.CreditsSoFar = scnr.nextInt();
  231. System.out.print("Grade point average: ");
  232. kid.GPA = scnr.nextDouble();
  233. return kid;
  234. }
  235. public static void save(Student pupil) throws Exception {
  236. String strFilename = "";
  237. Scanner scnr = new Scanner(System.in);
  238. System.out.print("Enter the file name: ");
  239. strFilename = scnr.next();
  240. // Make sure the user entered a valid file name
  241. if( !strFilename.equals("")) {
  242. // Indicate that you are planning to use a file
  243. File fleExample = new File(strFilename);
  244. // Create that file and prepare to write some values to it
  245. PrintWriter wrtStudent = new PrintWriter(fleExample);
  246. wrtStudent.println(pupil.StudentIdentificationNumber);
  247. wrtStudent.println(pupil.FirstName);
  248. wrtStudent.println(pupil.LastName);
  249. wrtStudent.println(pupil.CreditsSoFar);
  250. wrtStudent.println(pupil.GPA);
  251. // After using the PrintWriter object, de-allocated its memory
  252. wrtStudent.close();
  253. // For convenience, let the user know that the file has been created
  254. System.out.println("The file has been created.");
  255. }
  256. }
  257. public static void show(Student std) throws Exception {
  258. System.out.println("Student Record");
  259. System.out.println("Student ID: " + std.StudentIdentificationNumber);
  260. System.out.println("First Name: " + std.FirstName);
  261. System.out.println("Last Name: " + std.LastName);
  262. System.out.println("Number of credits so far: " + std.CreditsSoFar);
  263. System.out.println("Grade point average: " + std.GPA);
  264. }
  265. public static void main(String[] args) throws Exception {
  266. String answer = "n";
  267. Student std = register();
  268. Scanner scnr = new Scanner(System.in);
  269. System.out.print("Do you want to save this information (y/n)? ");
  270. answer = scnr.next();
  271. if( (answer.equals("y")) || (answer.equals("Y")) ) {
  272. show(std);
  273. save(std);
  274. }
  275. }
  276. }
  277. f1(){}
  278. f2/*surprise*/
  279. //
  280. ()/*surprise*/
  281. // ss
  282. {}
  283. // last line comment