Question

In: Computer Science

Design an application that focuses on decreasing the acceptability of and engagement in high-risk drinking among...

Design an application that focuses on decreasing the acceptability of and engagement in high-risk drinking among college students. The application should include:

1) files

2) arrays

3) methods

coding language c++

Solutions

Expert Solution

1.

#include <bits/stdc++.h>

using namespace std;

int main()

{    

   fstream file;

  

   file.open("Gfg.txt",ios::out);

   

   if(!file)

   {

       cout<<"Error in creating file!!!";

       return 0;

   }

   cout<<"File created successfully,";

file.close();

   return 0;

}

#include <iostream>

using namespace std;

int main()

{

    int arr[5];

    arr[0] = 5;

    arr[2] = -10;

    arr[3 / 2] = 2;

    arr[3] = arr[0];

cout << arr[0] << " " << arr[1]

<< " " << arr[2] << " " << arr[3];

    return 0;

}

3.class MyClass {   
  public:
    void myMethod() {  
      cout << "Hello World!";
    }
};

int main() {
MyClass myObj;
  myObj.myMethod();  
  return 0;
}


Related Solutions

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT