text:
Home > Vol 10, No 3 (2020) >	Ikbal
Muhammad Ikbal, Irwansyah Irwansyah, Ardi Paminto, Yana Ulfah, Dio Caisar Darma
Indonesia is currently in an honesty crisis, especially in financial governance, both
in government and private institutions. Our study uses the concept of financial intelligence to
identify and collect information related to financial affairs in an organization. We use the
opinions of 76 auditors regarding various fraudulent attempts, both with fraudulent financial
statements and other corrupt practices in organizations in Indonesia. Our important finding is
that small companies are more likely to commit fraud due to weak supervisors than listed public
companies. This is also more likely than family-owned companies and government level
organizations. It was indicated by some respondents that local government level organizations
with weak supervision are more likely to commit fraud than local governments with close
supervision from urban communities. The results of the non-parametric relationship analysis
show that although there is a possibility that the more experienced the auditor is, the more able
they are to detect fraud and manipulation in the organization, the relationship is relatively
weak. Other findings also show that auditors who have a CFE certificate find it easier to find
fraud in the company.
Bribes, financial intelligence, fraudulent financial statements, procurement of goods and services
Alavi, M. (2016). "Mitigating the Risk of Fraud in
Documentary Letters of Credit." Baltic
Journal of European Studies, 6(1), 139-156.
Albrecht, W. S., Hill, N. C., and Albrecht, C. C.
(2006). "The Ethics Development Model
Applied To Declining Ethics in Accounting."
Australian Accounting Review, 16(1), 30-40.
Ameyaw, C., Mensah, S., and Osei-Tutu, E.
(2012) "Public procurement in Ghana: The
implementation challenges to the Public
Procurement Law 2003 (Act 663)."
International Journal of Construction Supply
Chain Management, 2(2), 55–65.
Barua, A., Davidson, L. F., Rama, D. V., and
Thiruvadi, S. (2020). "CFO Gender and
Accruals Quality." Accounting Horizons, 24(1),
Birhanu, A. G., and Wezel, F. C. (2020). "The
competitive advantage of affiliation with
business groups in the political environment:
Evidence from the Arab Spring." Strategic
Organization, 1-23.
Bujaki, M., Lento, C., and Sayed, N. (2019).
"Utilizing professional accounting concepts to
understand and respond to academic
dishonesty in accounting programs." Journal
of Accounting Education, 47, 28–47.
Charlopova, I., Andon, P., and Free, C. (2020).
"How Fraud Offenders Rationalize Financial
Crime." In: Baker, H. K., Purda-Heeler, L., and
Saadi, S. (Ed.). Corporate Fraud Exposed,
Emerald Publishing Limited, 39-59.
Chychyla, R., Leone, A. J., and Minutti-Meza, M.
(2019). "Complexity of financial reporting
standards and accounting expertise." Journal
of Accounting and Economics, 67(1), 226-253.
Coenen, T. (2008). Essentials of Corporate Fraud,
John Wiley & Sons, Hoboken, NJ.
Coenen, T. (2009). Expert Fraud Investigation: A
Step-by-Step Guide, John Wiley & Sons,
Hoboken, NJ.
Cordis, A., and Lambert, E. (2017).
"Whistleblower laws and corporate fraud:
Evidence from the United States." Accounting
Forum, 41(4), 289-299.
Dincer, O., and Fredriksson, P. (2018).
"Corruption and environmental regulatory
policy in the United States: Does trust
matter?." Resource and Energy Economics, 54,
Dorrell, D. D., Gadawski, G. A., Bowen, H., and
Hunt, J. F. (2012). "Financial Intelligence:
People and Money Techniques to Prosecute
Fraud, Corruption, and Earnings
Manipulation." United States Attorneys'
Bulletin, 60(2), 1-65.
Dungan, J. A., Young, L., and Waytz, A. (2019).
"The Power of Moral Concerns in Predicting
Whistleblowing Decisions." Journal of
Experimental Social Psychology, 85, 103848.
Earley, C. E. (2015). "Data analytics in auditing:
Opportunities and challenges." Business
Horizons, 58(5), 493-500.
El-Helaly, M., Lowe, A. D., and Georgiou, I.
(2018). "The interplay between related party
transactions and earnings management: The
role of audit quality." Journal of International
Accounting Auditing and Taxation, 32, 47-60.
Elder, R. W., Lawrence, B., Ferguson, A., Naimi,
T. S., Brewer, R. D., Chattopadhyay, S. K.,
Toomey, T. L., and Fielding, J. E. (2010). "The
effectiveness of tax policy interventions for
reducing excessive alcohol consumption and
related harms." American Journal of
Preventive Medicine, 38(2), 217–229.
Ettredge, M. L., Scholz, S., and Li, C. (2007).
"Audit Fees and Auditor Dismissals in the
Sarbanes-Oxley Era." Accounting Horizons,
Ferry, L., and Lehman, G. (2018). "Trends in
corruption, environmental, ethical and social
accounting." Accounting Forum, 42(1), 1-2.
Glancy, F. H., and Yadav, S. B. (2011). "A
computational model for financial reporting
fraud detection." Decision Support Systems,
Graafland, J., and van Liedekerke, L. (2011).
"Case Description: Construction Fraud." In:
Dubbink W., van Liedekerke L., van Luijk H.
(eds) European Business Ethics Cases in
Context, Issues in Business Ethics, vol 28.
Springer, Dordrecht.
Gottschalk, P., and Rundmo, T. (2014). "Crime:
The amount and disparity of sentencing – A
comparison of corporate and occupational
white collar criminals." International Journal
of Law, Crime and Justice, 42(3), 175-187.
Habib, A., Ranasinghe, D., Muhammadi, A. H.,
and Islam, A. (2018). "Political connections,
financial reporting and auditing: Survey of the
empirical literature." Journal of International
Accounting, Auditing and Taxation, 31, 37-51.
Handayani, H., Tarjo, T., and Rimawati, Y.
(2016). "Correlation of financial statement
components in detecting financial fraud." Asia
Pacific Fraud Journal, 1(2), 275-300.
Henry, E., Gordon, E., Reed, B., and Louwers, T.
(2012). "The Role of Related Party
Transactions in Fraudulent Financial
Reporting." Journal of Forensic &
Investigative Accounting, 4(1), 186-213.
Holtfreter, K. (2015). "Is occupational fraud
'typical' white-collar crime? A comparison of
individual and organizational characteristics."
Journal of Criminal Justice, 33(4), 353-365.
Hopwood, A. G. (2008). "Changing pressures on
the research process: On trying to research in
an age when curiosity is not enough."
European Accounting Review, 17(1), 87–96.
Huang, Y., and Liu, L. (2014). "Fighting
corruption: A long-standing challenge for
environmental regulation in China."
Environmental Development, 12, 47-49.
Jakimow, T. (2018). "Negotiating Impossibilities
in Community-driven Development in
Indonesia." Journal of Developing Societies,
(1), 35–55.
Jakimow, T. (2018). "Being harmed while doing
good: affective injuries in a community
development programme, Medan, Indonesia."
Journal of the Royal Anthropological Institute,
Jeppesen, K. K. (2019). "The role of auditing in
the fight against corruption." The British
Accounting Review, 51(5), 100798.
Jones, M. J. (2011). Creative Accounting, Fraud
and International Accounting Scandals, John
Wiley & Sons Inc, Chichester.
Karpoff, J. M. (2020). "The future of financial
fraud." Journal of Corporate Finance, 101694,
Kassem, R. (2018). "Exploring External Auditors'
Perceptions of the Motivations behind
Management Fraud in Egypt-A Mixed
Methods Approach." Managerial Auditing
Kassem, R. (2018). "Exploring external auditors'
management fraud in Egypt – a mixed
methods approach." Managerial Auditing
Kassem, R. (2019). "Understanding financial
reporting fraud in Egypt: evidence from the
audit field." Third World Quarterly, 40(11),
Kemp, G. (2010). "Fighting public sector fraud in
the 21st century." Computer Fraud &
Security, 11, 16-18.
Kendall, H., Kuznesof, S., Dean, M., Chan, M-Y.,
Clark, B., Home, R., Stolz, H., Zhong, Q., Liu,
C., Brereton, P., and Frewer, L. (2019).
"Chinese consumer's attitudes, perceptions
and behavioural responses towards food
fraud." Food Control, 95, 339-351.
Kose, I., Gokturk, M., and Kilic, K. (2015). "An
interactive machine-learning-based electronic
fraud and abuse detection system in
healthcare insurance." Applied Soft
Computing, 36, 283–299.
Kuhn, M., and Siciliani, L. (2013). "Manipulation
and auditing of public sector contracts."
European Journal of Political Economy, 32(C),
Lambsdorff, J. G. (2002). "How Confidence
Facilitates Illegal Transactions—an Empirical
Approach." American Journal of Economics
and Sociology, 61(4), 829-853.
Lewis, B., and Hendrawan, A. (2019). "The
impact of majority coalitions on local
government spending, service delivery, and
corruption in Indonesia." European Journal of
Political Economy, 58, 178-191.
Loeb, S., Dynarski, S., McFarland, D., Morris, P.,
Reardon, S., and Reber, S. (2014). Descriptive
Analysis in Education: A Guide for
Researchers, National Center for Education
Evaluation and Regional Assistance,
Lombardi, D. R., Bloch, R., and Vasarhelyi, M. A.
(2015). "The Current State and Future of the
Audit Profession." Current Issues in Auditing,
Lord, B. R., and Robb, A. (2010). "Women
students and staff in accountancy: The
Canterbury tales." Accounting History, 15(4),
Makhaiel, N., and Sherer, M. (2017). "In the
Name of Others: An Investigation of Earnings
Management Motives in Egypt." Journal of
Accounting in Emerging Economies, 7(1), 61–
Malimage, K. (2019). "Application of
underutilized theories in fraud research:
Suggestions for future research." Journal of
Forensic & Investigative Accounting, 11(1), 33-
Mamedova, N. A., Aleksandrova, K. S., and
Khydyrova, A. V. (2017). "State Policy in the
Sphere of Education (at the Example of
Government Programs in Russia in 2011-
." International Journal of Economic
Research, 14(15), 183-197.
Meehan, F., and Tacconi, L. (2017). "A framework
to assess the impacts of corruption on forests
and prioritize responses." Land Use Policy, 60,
Michels, J. (2016). "Disclosure Versus
Recognition: Inferences from Subsequent
Events." Journal of Accounting Research,
Miroslav, M., Miloš, M., Velimir, Š., Božo, D., and
Đorđe, L. (2014). "Semantic technologies on
the mission: Preventing corruption in public
procurement." Computers in Industry, 65(5),
Othman, R., Aris, N. A., Mardziyah, A., Zainan,
N., and Amin, N. M. (2015). "Fraud Detection
and Prevention Methods in the Malaysian
Public Sector: Accountants' and Internal
Auditors' Perceptions." Procedia Economics
and Finance, 28, 59-67.
Puspasari, N. (2015). "Fraud theory evolution
and its relevance to fraud prevention in the
village government in Indonesia." Asia Pacific
Fraud Journal, 1(2), 177-188.
Quick, R., and Schmidt, F. (2018). "Do audit firm
rotation, auditor retention, and joint audits
matter? – An experimental investigation of
bank directors' and institutional investors'
perceptions." Journal of Accounting
Literature, 41, 1-21.
Ragatz, L. L., Fremouw, W., and Baker, E. (2012).
"The Psychological Profile of White-collar
Offenders: Demographics, Criminal Thinking,
Psychopathic Traits, and Psychopathology."
Criminal Justice and Behavior, 39(7), 978–
Rezaee, Z. (2005). "Causes, consequences, and
deterence of financial statement fraud."
Critical Perspectives on Accounting, 16(3),
Roychowdhury, S., Shroff, N., and Verdi, R. S.
(2019). "The effects of financial reporting and
disclosure on corporate investment: A review."
Journal of Accounting and Economics, 68(2-3),
Rudner, M. (2006). "Using Financial Intelligence
Against the Funding of Terrorism."
International Journal of Intelligence and
Counter Intelligence, 19(1), 32-58 .
Salihu, A., and Berisha-Hoti, X. (2019). "The
Effect of IT Audit on Security Incidents."
International Journal of Scientific &
Technology Research, 8(8), 1342-1347.
Scott, B., and McGoldrick, M. (2018). "Financial
intelligence and financial investigation:
opportunities and challenges." Journal of
Policing, Intelligence and Counter Terrorism,
Sharma, S., and Soederberg, S. (2020).
"Redesigning the business of development: the
case of the World Economic Forum and global
risk management." Review of International
Political Economy, 27(4), 828-854.
Singh, S. K., Giudice, M. D., Tarba, S. Y., and
Bernardi, P. D. (2019). "Top Management
Team Shared Leadership, Market-Oriented
Culture, Innovation Capability, and Firm
Performance." IEEE Transactions on
Engineering Management, 99, 1-11.
Sterling, T. F. (2002). The Enron Scandal, Nova
Science, New York.
Subedi, D. (2016). "Explanatory Sequential
Mixed Method Design as the Third Research
Community of Knowledge Claim." American
Journal of Educational Research, 4(7), 570-
Suh, J. B., Nicolaides, R., and Trafford, R. (2019).
"The effects of reducing opportunity and fraud
risk factors on the occurrence of occupational
fraud in financial institutions." International
Journal of Law, Crime and Justice, 56, 79-88.
Sulistiyanto, F., and Murtini, H. (2018).
"Determinants of Internal Auditor
Performance through Knowledge
Management with Organizational Culture as
Moderating." Accounting Analysis Journal,
The American Institute of Certified Public
Accountants. (2007). Concealed liabilities: 1–7,
Retrieved from http://www.aicpa.org
The Association of Certified Fraud Examiners.
(2016). Tone at the top: How management can
prevent fraud in the workplace, 1–80,
Retrieved from http://www.acfe.com
The Chartered Global Management Accountant.
(2015). Managing Responsible Business: The
Ethical Challenges Organisations Must
Navigate to Succeed in a Connected World, 1–
, Retrieved from
https://www.cgma.org/resources/reports/2015-
managing-responsible-business.html
The Institute of Business Ethics. (2018).
Improvements in ethics at work, Retrieved
from https://pressat.co.uk/releases/one-infive-
french-employees-say-they-have-feltunder-
pressure-to-compromise-theirorganisations-
ethical-standards-revealsinstitute-
of-business-ethics-survey-
d4af34d6d4f24cda7aea4bf42f0/
Thony, J. F. (1996). "Processing Financial
Information in Money Laundering Matters:
The Financial Intelligence Units." European
Journal of Crime, Criminal Law and Criminal
Justice, 4(3), 257-282.
van Ruth, S. M., Huisman, W., and Luning, P. A.
(2017). "Food fraud vulnerability and its key
factors." Trends in Food Science and
Technology, 67, 70-75.
Wells, P. (2005). "Earnings management
surrounding CEO changes." Accounting &
Finance, 42(2), 169-193.
West, J., and Bhattacharya, M. (2016).
"Intelligent financial fraud detection: A
comprehensive review." Computers &
Ulfah, Y., Irwansyah, I., Ikbal M., Paminto, A.,
and Darma, D. C. (2020). "Employees are faced
with whistleblowing reporting channel
alternatives: Which one is more desirable?."
Espacios, 41(31), 18-32.
Zager, L., Malis, S. S., and Novak, A. (2016). "The
Role and Responsibility of Auditors in
Prevention and Detection of Fraudulent
Financial Reporting." Procedia Economics and
Finance, 39, 693-700.


We now have access to a range of Biante 1/18, 1/43, & 1/64 models. This premium range is currently available by pre-order only. Please refer to our Pre-Order page.
Note: A wider range of Biante is available. Please send us an email if there is something in particular you are after.


text:
package ueb03;

public interface Folgengenerator {

    /**Liefert die Folge aller Ganzzahlen von 1 bis n als Zeichenkette, jeweils mit einem nachstehenden Zwischenraum.*/
    public String folge(final int n);

    /**Liefert die Folge aller Ganzzahlen von 1 bis n als Zeichenkette, jeweils mit einem nachstehenden Zwischenraum.
     * Das daraus ermittelte Ergebnis wird noch mit accu konkateniert.*/
    public String folge(final int n, final String accu);

}

redpajama_set_name: RedPajamaGithub


Are you new to programmatic advertising? Maybe you've heard people talk about it but don't really understand what it is.
If you've browsed the internet today, it's likely you've seen a digital ad that was placed using programmatic media buying, but what does that even mean? Most people only have a vague idea of what programmatic is, and this article will introduce you to the basics of programmatic advertising and how it works.
Today, with digital advertising evolving in many directions, it can be difficult to explain the term "programmatic" without running the risk of getting trapped in jargons. Plus, sifting through the sheer number of digital media platforms and options — from display, native, social, video, digital out-of-home, streaming audio and even advanced TV (OTT) — can feel like a seemingly baffling process to understand. So, first, let's strip it down to fundamentals.
We're all familiar with the traditional way of buying digital advertising, which involves bidding through proposals, tenders, quotes, human negotiations, and decision-making in terms of what ads to buy and where to run them. It's worked fine, but it's a pretty manual process and there's a lot of guesswork involved. You can think of programmatic advertising in terms of economics – put simply, it's using software-driven technology to connect supply (seller/publisher) and demand (buyer/advertiser).
Publishers focus on yield and want to sell their ad space for the most money possible, and advertisers focus on their key performance indicators (KPIs) and want to pay the least amount of money as possible for the exact right audience. What's so great about programmatic is that it connects buyer and seller, allowing for an open biddable marketplace, and essentially democratizes media buying. But perhaps the most important distinction is that instead of buying a specific site the traditional way, hoping you're reaching your exact audience, programmatic is audience-based and data-driven, so the process uses advanced algorithms and rich data integrations to find your exact audience, regardless of site, across the internet. Because of this, you're buying more efficiently and eliminating a lot of media waste.
In 2014, Forrester had rightly predicted that programmatic will account for the majority of all digital advertising spending over the next few years. Today, programmatic advertising is growing at a steady pace. With more than $65 billion estimated to be invested in programmatic advertising by 2020, over 86% of total digital display ads will be purchased programmatically in the US, according to the latest eMarketer report. The same report predicts mobile programmatic display spending to reach $48B in 2020, while digital video isn't too far behind at $19B.
Ad buying efficiency: Programmatic allow for better cost efficiencies, real time reporting and optimizations and overall more flexibility to work with dozens of media outlets, data partners, and of course tactic and targeting types.
Speed and scale: Programmatic automates the ad buying and selling, eliminating the unreliability and slowdowns that humans bring to the process.
Targeting relevancy: Programmatic helps advertisers leverage data to serve users with ads that are more relevant to them based on demographic, behavioral and intent signals. It allows you to choose exactly who sees your ads, meaning that you only pay for those ads that your chosen audience gets to see.
Programmatic uses a mix of data sources to give advertisers the advantage to target audiences that are most likely to respond when an ad is displayed on the web page. This data may come from (1) cookies that websites use to track user behavior, (2) first-party data such as customer emails, types of products purchased, most recent purchases etc., and (3) third-party data such as demographic, income, credit score etc. from data aggregators like Acxiom, Datalogix, BlueKai, comScore, Experian, and LiveRamp.
When the cookie or any other identifier like login IDs match the targeting, criteria set by the advertiser, the ad buying system (a trading desk or demand side platform) will bid on the impression automatically. Among those competing for the impression, the advertiser that bids the most wins the right to display their ad. When a customer clicks on the ad, it gets converted into a sale for the advertiser. Programmatic advertising is one of the best ways to ensure clicks and traffic that can lead to conversations, and potential sales for your business.
Practically, there's really no way a human can crunch through such large amounts of data to optimize your digital ad campaigns, while improving your ROI.
As programmatic closes in on larger and larger portions of the overall display market, it's being seen by many as the future of advertising on the web. Thanks to efficiencies in programmatic targeting, cost and delivery, programmatic advertising is headed for a bright future. If you want to take advantage of programmatic for your marketing and ad campaigns, this is probably the best time to start.
New Angle Media offers programmatic advertising as a service to our clients. By adding this to our repertoire, we are positioning ourselves at the forefront of the technology and looking towards the future of digital advertising.
If you're curious about programmatic advertising or want to discuss what it could mean for your business, we want to hear from you. Contact us today!


text:
Groton woman to lead sales at Hampton Inn
Kate Nicholson of Groton has been named director of sales for Hampton Inn Bedford/Burlington in Bedford.
Nicholson is a graduate of Regis College in Weston. She has previous hotel experience at the Radisson Hotel in Chelmsford, Hampton Inn and Crowne Plaza, both in Worcester, and the Holiday Inn Select in Woburn.
Sullivan Bille, P.C., a regional accounting firm with offices in Tewksbury, Boston and Salem, N.H., recently announced the following additions:
* Tracy Descoteaux of Brentwood, N.H., joined the firm's audit team as a supervisor. She holds a bachelor's degree in business administration, with a concentration in accounting, from St. Joseph College.
* Mark J. Gordon of Derry, N.H., also joined the audit team as a supervisor. He holds a bachelor's degree in business administration, with a concentration in accounting, from Northeastern University.
* Jacqueline M. Endyke of Londonderry, N.H., was hired to the administrative team. She holds an associate's degree in business science from Castle College.
Andrea Thibeault of Hudson, N.H., has been named e-commerce director at Buffalo Lodging Associates, LLC.
She is responsible for the management of brand We sites for the company's portfolio of nearly 40 hotels, which include the Hampton Inn Bedford/Burlington in Bedford.
Thibeault holds a degree in hospitality management from Johnson & Wales University.
Christine Schuster, president and CEO of Emerson Hospital in Concord, was recently voted chairperson of the Board of Directors for the Massachusetts Health and Educational Facilities Authority (HEFA).
Schuster brings more than 20 years of health-care experience.
HEFA is a quasi-public authority that provides low-cost funds to nonprofit organizations in health care, higher education, science, culture and the arts.

redpajama_set_name: RedPajamaCommonCrawl


text:
The Blotter – February 23
Monday, 2/13
1:03 p.m.: A student reported being injured after falling on the stairs outside of Persson Hall and was transported to Community Memorial Hospital by Campus Safety.
4:29 p.m.: Carbon Monoxide alarm activation at 40 Broad Street (Kappa Kappa Gamma). Campus Safety was assisted by the Hamilton Fire Department.
5:23 p.m.: A resident of West Hall was found in possession of marijuana and had been smoking in a residence hall. Case referred for disciplinary action.
Tuesday, 2/14
12:38 a.m.: Received a report of an underage intoxicated student at Frank Dining Hall. Student passed an alcohol assessment and was escorted to his room by Campus Safety. Case referred for disciplinary process.
11:14 a.m.: Fire alarm activation at Frank Dining Hall was caused by cooking.
1:35 p.m.: A student reported an altercation between himself and another student that occurred off campus on Sunday, 2/12/2017. Case referred for disciplinary process.
3:11 p.m.: A resident of the Townhouse Apartments was found in possession of marijuana and drug paraphernalia. Case referred for disciplinary action.
6:20 p.m.: A resident of West Hall was found in possession of a candle. Case referred for disciplinary action.
6:35 p.m.: An underage resident of Andrews Hall was found in possession of alcohol. Case referred for disciplinary action.
7:42 p.m.: A resident of Shepardson House was found in possession of marijuana, drug paraphernalia and had covered a smoke detector. Case referred for disciplinary action.
Wednesday, 2/15
5:56 p.m.: A resident of the Townhouse Apartments was found to have covered a sprinkler head. Case referred for disciplinary action.
6:50 p.m.: A resident of 76 Broad Street reported a visitor staying for more than the allotted three days.
6:55 p.m.: A resident of University Court Apartments was found in possession of candles. Case referred for disciplinary action.
Thursday, 2/16
12:36 a.m.: A resident of Shepardson House was found in possession of marijuana, drug paraphernalia and had been smoking in a residence hall. Case referred for disciplinary action.
12:48 a.m.: Fire alarm activation at the Townhouse Apartments was caused by cooking.
2:05 p.m.: A staff member reported being injured after falling in the Huntington Gym parking lot.
6:25 p.m.: A resident of 110 Broad Street was found to have covered a smoke detector. Case referred for disciplinary action.
6:25 p.m.: A resident of 110 Broad Street was found in possession of a toaster oven. Case referred for disciplinary action.
Friday, 2/17
1:36 a.m.: Received a report of an underage intoxicated student near 40 Broad Street (Kappa Kappa Gamma) who was transported to Community Memorial Hospital by Campus Safety. Student was also in possession of a fraudulent driver's license. Case referred for disciplinary action.
8:18 a.m.: A resident of Parker Apartments reported a broken window at her apartment.
12:00 p.m.: A staff member reported graffiti on the Dana Arts Center roof.
10:47 p.m.: A resident of West Hall was found in possession of marijuana and had been smoking in a residence. Case referred for disciplinary action.
Saturday, 2/18
3:28 a.m.: Received a report of an underage intoxicated student at Drake Hall who was transported to Community Memorial Hospital by Campus Safety.
4:15 p.m.: Fire alarm activation at 92 Broad Street (Phi Kappa Tau) was caused by a water leak.
4:23 p.m.: Campus Safety reported damage to a wall at 92 Broad Street.
10:19 p.m.: Students at Andrews Hall were found in possession of marijuana. Case referred for disciplinary action.
11:41 p.m.: A student was injured at Andrews Hall after falling on the stairs and was transported to Community Memorial Hospital by Campus Safety.
Sunday, 2/19
2:30 a.m.: Received a report of an underage intoxicated student at the Townhouse Apartments bus stop who was transported to Community Memorial Hospital by Campus Safety. Case referred for disciplinary action.
12:02 p.m.: A staff member reported his university owned laptop was stolen from his vehicle while in North Carolina.
11:54 p.m.: Received a report of a larceny and vandalism at 110 Broad Street.
Good Nature Farm Brewery Struggles Amid Mounting Financial Issues
Norwich Meadows Farm's Zaid Kurdeih Discusses Religion and Sustainability in Farming
Michael Shellenberger Gives Controversial Lecture Discussing Alternative Climate Change Solutions
Annual 'Night of Lights' Tree Lighting Ceremony Brings Holiday Cheer to Hamilton
Artist Adam Frelin Proposes Lighthouse Installation Above Little Hall
Office of LGBTQ+ Initiatives and Student Health Services Host Sexual Health Fair
Brief: ALANA Announces Bishop Edwin C. Bass as MLK Celebration Keynote Speaker
University Outlines Plans for Long-Term Lower Campus Residential Redesign
Education Department and University Museums Debut Story Walk Outside Persson Hall
Brief: SGA Invites Students to Vote for Springfest Headliner
All The Colgate Maroon-News Picks Reader Picks Sort: Newest


text:
Q: C++: float value reused across iteration Let's look at the following piece of code which I unintentionally wrote:
void test (){
for (int i = 1; i <=5; ++i){
    float newNum;
    newNum +=i;
    cout << newNum << " ";
}
}

Now, this is what I happened in my head:
I have always been thinking that float newNum would create a new variable newNum with a brand-new value for each iteration since the line is put inside the loop. And since float newNum doesn't throw a compile error, C++ must be assigning some default value (huhm, must be 0). I then expected the output to be "1 2 3 4 5". What was printed was "1 3 6 10 15".
Please help me know what's wrong with my expectation that float newNum would create a new variable for each iteration?
Btw, in Java, this piece of code won't compile due to newNum not initialized and that's probably better for me since I would know I need to set it to 0 to get the expected output.

A: Since newNum is not initialized explicitly, it will have a random value (determined by the garbage data contained in the memory block it is allocated to), at least on the first iteration.
On subsequent iterations, it may have its earlier values reused (as the compiler may allocate it repeatedly to the same memory location - this is entirely up to the compiler's discretion). Judging from the output, this is what actually happened here: in the first iteration newNum had the value 0 (by pure chance), then 1, 3, 6 and 10, respectively.
So to get the desired output, initialize the variable explicitly inside the loop:
float newNum = 0.0;

A:
C++ must be assigning some default
  value (huhm, must be 0)

This is the mistake in your assumptions. C++ doesn't attempt to assign default values, you must explicitly initialise everything.
Most likely it will assign the same location in memory each time around the loop and so (in this simple case) newNum will probably seem to persist from each iteration to the next.
In a more complicated scenario the memory assigned to newNum would be in an essentially random state and you could expect weird behaviour.
http://www.cplusplus.com/doc/tutorial/variables/

A: The float you are creating is not initialised at all. Looks like you got lucky and it turned out to be zero on the first pass, though it could have had any value in it.
In each iteration of the loop a new float is created, but it uses the same bit of memory as the last one, so ended up with the old value that you had.
To get the effect you wanted, you will need to initialise the float on each pass.
float newNum = 0.0;

A: Using garbage value in your code invokes Undefined Behaviour in C++. Undefined Behavior means anything can happen i.e the behavior of the code is not defined.
float newNum; //uninitialized (may contain some garbage value)
newNum +=i; // same as newNum=newNum+i
                              ^^^^^
                              Whoa!!

So better try this
  float newNum=0; //initialize the variable
  for (int i = 1; i <=5; ++i){
      newNum +=i;
      cout << newNum << " ";
  }

A: The mistake in thoughts you've expressed is "C++ must be assigning some default value". It will not. newNum contains dump.

A: I don't do too much C++ since last month, but:
The float values is newly allocated for each iteration. I'm a bit surprised about the initial zero value, though. The thing is, after each iteration, the float value runs out of scope, the next step (the reenter of the loop scope) first reallocates the float memory and this will often return the same memory block that was just freed.
(I'm waiting for any bashing :-P)

A: You are using an uninitialized automatic stack variable. In each loop iteration it is located at the same place on the stack, so event though it has an undefined value, in your case it will be the value of the previous iteration.
Also beware that in the first iteration it could potentialliay have any value, not only 0.0.

A: You might have got your expected answer in a debug build but not release as debug builds sometimes initialise variables to 0 for you. I think this is undefined behaviour - because C++ doesn't auto initialise variables for you, every time around the loop it is creating a new variable but it keeps using the same memory as it was just released and doesn't scrub out the previous value. As other people have said you could have ended up with complete nonsense printing out.
It is not a compile error to use an uninitialised variable but there should usually be a warning about it. Always good to turn warnings on and try to remove all of them incase something nastier is hidden amongst them.

A:
C++ must be assigning some default value (huhm, must be 0).

C++ doesn't initialize things without default constructor (it may set it to something like 0xcccccccc on debug build, though) - because as any proper tool, compiler "thinks" that if you haven't provided initialization then it is what you wanted. float doesn't have default constructor, so it is unknown value.

I then expected the output to be "1 2 3 4 5". What was printed was "1 3 6 10 15".
Please help me know what's wrong with my expectation that float newNum would create a new variable for each iteration?

Variable is a block of memory. In this variable is allocated on stack. You didn't initialize it, and each iteration it just happen to be placed on the same memory address, which is why it stores previous value. Of course, you shouldn't rely on such behavior. If you want value to persist across iterations, declare it outside of loop.

Btw, in Java, this piece of code won't compile due to newNum not initialized

BTW, in C++ normal compiler would give you a warning that variable is not initialized (Example: "warning C4700: uninitialized local variable 'f' used"). And on debug build you would get crt debug error (Example: "Run-Time check failure #3 - The variable 'f' is being used without being initialized").

and that's probably better

Negative. You DO need uninitialized variables from time to time (normally - to initialize them without "standard" assignment operator - by passing into function by pointer/reference, for example), and forcing me to initialize every one of them will be a waste of my time.

redpajama_set_name: RedPajamaStackExchange